Enabling Editing Using the DataGrid
Chapter 7, “Working with ASP.NET Server Controls Templates,” discussed working with templates and columns, and you learned what bound columns are. The EditCommandColumn is one of these columns; it's a single row within a DataGrid and by default doesn't contain any data from your data source. Listing 10.1 shows how to insert the EditCommandColumn in your DataGrid.
Listing 10.1. Inserting the EditCommandColumn
01: <asp:DataGrid 02: id="DGProducts" 03: runat="server" 04: AutoGenerateColumns="true" 05: OnEditCommand="DGProducts_Edit" 06: OnCancelCommand="DGProducts_Cancel" 07: OnUpdateCommand="DGProducts_Update" 08: OnDeleteCommand="DGProducts_Delete" 09: > 10: <Columns> 11: <asp:EditCommandColumn 12: ButtonType="LinkButton" ... |
Get Programming Data-Driven Web Applications with ASP.NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.