Adding a bound Column to a Data Grid

The default column used in a Data grid is a bound column. If only limited columns are to be displays and controlled from a Data source, declaration of one more Bound Columns controls is done explicitly. The following example demonstrates it :-

The above example, displays only the first Name and Last Name columns from the Employees table.

Note that the Data grid controls auto generate columns property is set the not value false so that, all the columns from the Employees table are displayed , and the First Name columns are displayed twice as shown below :-

Therefore it is important to take care of auto generate columns property of data grid control.

Further in the above example the Bound columns are declared inside the Data grid controls tag. This tag contains a bound column for the Titles column and a bound column for price column. The Data field property indicates the field from the source to display in the bound column.

No comments:

Post a Comment