Updating a gridview
For example if the column name is Name its corresponding parameter name will be @Name.Once this is done the Sql Data Source will automatically pick values from respective Text Boxes inside the Grid View row to be edited. Deleting data from gridview using sqldatasource control 14. Using stored procedures with objectdatasource control 13. Using stored procedures with sqldatasource control 12.
The Button Type property specifies the type of button to be displayed in the Grid View control. Now, we need to find a method that binds each row to the data source of the Grid View control when it is loaded.Fortunately the event Grid View_Row Data Bound come to our rescue.In this article, I am going to take a simple database table that has following fields: Auto ID - Int, Auto Increment, Primary Key Page Name - Varchar(50) Page Description - Varchar(500) Active - Bit(1) In this article, I am not going to explain the workings of Sql objects but focusing on the events and methods of the Grid View that will help us in updating and deleting the records.Now let’s start with putting the Grid View on page. Data Key Names="Auto ID" Auto Generate Edit Button="True" On Row Editing="Edit Record" On Row Canceling Edit="Cancel Record" On Row Updating="Update Record" Cell Padding="4" Header Style-Horizontal Align="left" On Row Deleting="Delete Record" Row Style-Vertical Align="Top" Fore Color="#333333" Grid Lines="None" In the above code, I have kept Auto Generate Columns as false so that Grid View will not render all the fields of the data source automatically.
Search for updating a gridview:
Editing and updating data in gridview using sqldatasource control 18.