The Repeater Server Control

The DataGrid control is certainly a convenient control to use for displaying the results of a search or displaying simple records. However, DataGrid has some deficiencies as an editing tool. First and foremost, notice the difference in the overall width of the data grids shown in Figure 9-1 and Figure 9-2. This difference is a bit of a problem when you're working with the number of fields in the example DataGrid, but it would be a far worse problem if there were many more fields.

The second deficiency is the lack of easy control over how the editing takes place. One solution to this problem is to use TemplateColumn objects to describe what the column should look like when it's being viewed and when it's being edited. Using a TemplateColumn object and setting the EditltemTemplate property is a reasonable approach when perhaps only one or two columns in a record are to be edited. The Customer table that we've been working with contains both of these deficiencies. First, the Customer table includes date columns and an e-mail column. These columns require special validation—in the case of the ContractEnds field, a check for a valid date, and in the case of the ContactEMail field, a check for a plausible e-mail address. Next, the Customer table has quite a few more columns than could be conveniently displayed one per column across the page. Listing 9-3 shows the SQL statement to create the full Customer table.

0 0

Post a comment