Adding Event-Handling Code
Your page is all laid out, and the DataGrid control contains both its ItemTemplate and EditItemTemplate sections, but you won't be able to edit or update data yet— you must add code to handle the EditCommand, UpdateCommand, and CancelCommand events raised by the control. When you click the Edit button on the page, the DataList control raises its EditCommand event (and your code can react to that event). The same applies to the Update and Cancel buttons, triggering the UpdateCommand and CancelCommand events, respectively.
When you click the Edit button, you trigger a postback to the page. Back on the server, you need to somehow indicate to the DataList control that it's now in “edit” mode and it should display its EditItemTemplate ...
Get ASP.NET Developer's JumpStart 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.