The sample scripts are not supported under any Microsoft standard support program or service.The sample scripts are provided AS IS without warranty of any kind.
When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.
When the Button is clicked, the Insert function of the Sql Data Source is executed which then inserts the records to the database and binds the Grid View again to display the newly inserted record.
For example if the column name is Name its corresponding parameter name will be @Name. Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.
You may notice that the last column of the Grid View is a Delete column that let user delete the record from database, so I have placed Delete link button inside the tag and have specified on Click property as Java Script confirm return value, so that when user clicks on it he/she sees a confirmation box whether he/she really wants to delete the record.
Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View.
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.