The ASP.NET DataGrid component is a very powerful interface control that supports a myriad of features and functionality. It is however, often misused and misunderstood. Due to the depth of functionality built into the DataGrid component developers are often “reinventing the wheel” in certain situations simply because they are unaware the DataGrid already provides the required functionality, or they discover the functionality simply too complex to work with.
Here are some features provided by the DataGrid component out-of-the-box:
- Automatic generation of an HTML table when bound to a DataSource
- May be bound to several DataSource objects, such as DataSet, DataTable, DataView, ArrayList
- Provides built in column sorting
- Provides built in data paging and Next/Back navigation
- Allows row selection with highlighting
- Supports full row by row customization of data presentation through the ItemDataBound event
- Provides built in Edit/Update/Cancel functionality
When we say built-in what we really mean is that the basic plumbing for using this functionality is already built into the component, however the definitions of these features must be programmed because they are dependent on your specific needs for your application.
In this tutorial we will examine the built in functionality for Edit/Update/Cancel. We will implement a bound DataGrid component and see how we can edit the fields in the DataGrid right on the page, and update those fields to the database.
This functionality can be entirely designed through Dreamweaver’s wizards and dialogue boxes and requires absolutely no coding on behalf of the developer.
Note: For this tutorial you will need to know how to setup an ASP.NET site in Dreamweaver, as well as how to connect to a database of your choice and create a DataSet object for binding to the DataGrid.