We configured though the Edit Item Template of the Template Field, to contain two other Link Button controls, with Command Name “Update” and “Cancel”. If so, i just disable the linkbutton and finally, you can’t press it.They work in similar and respective way as the “Edit” command. Go to Grid View’s code add a handler for the On Row Data Bound like this.
In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.Working with a Grid View in an Update Panel is pretty quick and simple for many reasons, but when you require a full postback instead of an asynchronous one you can run into some trouble.In a previous post we saw how easy is to bind data to a Grid View control, without using a build in Data Sources.Now I will show you the C# code behind file of the above ASP.
NET page that will handle different Grid View events to provide complete editing functionality.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.By Default, Grid View control displays Item Template which directly shows the Product Name and Unit Price columns but when user clicks Edit button Grid View automatically switches to Edit Item Template and display the control available inside Edit Item Template for user editing.But still, isn’t so fancy and moreover doesn’t support editing and updating records. The one for Editing has a Command Name attribute assigned to “Edit”.We are going to modify a little bit our gridview control. This actually tells the Sql Data Source we configured in previous step, to change the Grid View in edit mode.Editing the Grid View control can be an incredibly easy feature to add for certain database tables, especially those who have no foreign key associated and can easily be edited through the use of a standard Text Box web control as shown in the figure below: Before we start examining the ASP.