| |||||||||||||||||||||||||||||
Introduction to the DataGrid ControlControls You Can Use on Web Forms ASP.NET Data Controls DataGrid Control The DataGrid Web server control is a full-featured data-bound control that displays data in tabular format, and provides the ability to sort, select, edit, and delete records from its associated data source. The DataGrid control displays one row for each record in the data source, and by default, generates a column for each field. You can, however, choose which fields in the data source will render in the grid. The DataGrid control can automatically page over the data, if the underlying data source supports paging. The following sections briefly introduce the main features of the DataGrid control. Binding Data to the Control
The DataGrid control provides the following options for binding to data:
When binding to a data source using the DataSourceID property, the DataGrid control supports two-way data binding. In addition to displaying data, the control automatically supports update and delete operations on the bound data. For more information, see Binding to Data Using a Data Source Control. When using the control to allow users to edit or delete data, you have to set the DataKeyField property to specify the name of the primary key field that uniquely identifies each record in the data source. This information is needed for the automatic update features to work, but does not have to be part of the information displayed in the form. For details on using the DataGrid control for updating data, see Allowing Users to Edit Rows in a DataGrid Control. For general information about data binding in server controls, see Data Binding in Web Forms. Customizing the DataGrid Control User InterfaceThe DataGrid control supports a Columns collection property, that can be used to set the collection of objects that represent the columns of a DataGrid control. The following table lists the different column types you can specify for the DataGrid.
StylesThe DataGrid control also supports additional customization of the user interface by using style properties. The following table lists the style properties you can specify for the DataGrid.
In addition, the DataGrid supports additional customization using Cascading Style Sheets (CSS). For more information, see Web Forms Server Controls and CSS Styles. See AlsoAdding DataGrid Controls to a Web Forms Page |
| ||||||||||||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme