Nor does it represent the opinion of my dog, because I don’t have one.This demo describes the different approach to display a confirmation message when deleting a row in Grid View and pass the id of the item to the confirmation message.As you can see from the above code blocks, we attached the Java Script function in the Link Button by adding an attributes to the control.
If user click 'No', abort the server event (Row Updating).
Confirmation means a user is asked first if he/she wanted to delete a record by choosing an option (OK and CANCEL).
In this demo, we use the Java Script confirm function for displaying the confirmation message. To do this switch to ASPX source and add the following code block within the The Show Delete Button Command Field is a built-in command in Grid View to preform delete.
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.