NET page that will handle different Grid View events to provide complete editing functionality.In the Page_Load event, you simply load your data from the database and bind it with the Grid View control as shown below: For brevity I am not storing connection string in the web.config and also not using any Data Access Component.These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.This collection only requires the row index no and it will give us the primary key.
(Switch to the Visual Basic tutorial.) In this tutorial, we'll see how easy it is to add validation controls to the Edit Item Template and Insert Item Template of a data Web control, to provide a more foolproof user interface.
When editing a row in a Grid View or Details View, those Bound Fields that are not read-only are converted into textboxes, from which the end user can modify the existing data.
Similarly, when inserting a new record into a Details View control, those Bound Fields whose Insert Visible property is set to true (the default) are rendered as empty textboxes, into which the user can provide the new record's field values.
Additionally, the page included a Details View whose Default Mode property was set to Insert, thereby always rendering in insert mode.
From this Details View, the user could enter the name and price for a new product, click Insert, and have it added to the system (see Figure 1). The previous example allows users to add new products and edit existing ones.