Hope this article helps to begin working with Grid View control. Right now I have a label turn to visible true and a message when someone either edits or deletes something successfully.If you have a feedback or suggestion, please do write to me. Full Name: Sheo Narayan Member Level: Honorary Platinum Member Status: Administrator Member Since: 7/8/2008 PMCountry: India Regards, Sheo Narayan MVP, Author, Writer, Mentor & architecting applications since year 2001. What would you do if you wanted to have an event trigger when you click on the "cancel" button during the delete process. When a person starts to delete another item and decides to cancel the delete, the old message from the previously edited or deleted item still shows. ya,its how can I use the button field for the edit and delete in the template field.suppose i used that controls,what kind of events could I used for edit successfully? When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.In this method, I am specifying the Edit Index property of the Grid View to the New Edit Index of the Grid View and then calling Bind Data() method again to bind the data.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.I will be using Sql objects directly into methods to keep the example simple and straight forward.In practical scenario you should use your existing architecture to populate and update the data.
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.In this method, I am specifying the Edit Index property of the Grid View to -1.As there is no row at -1 position so Grid View will be shown in normal mode.In this article, I am going to explain how to manipulate data using Grid View control.