These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.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.Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.
Instead, you can use the on Cell Click option to handle the event.
When implementing a handling function for this event, use the object passed to this function as its parameter.
In this tutorial we are searching for our Text Box controls txt Product Name and txt Unit Price.
To get the Primary Key reference we can use the Data Keys collection of the Grid View.
This collection only requires the row index no and it will give us the primary key.
Last line of the following code is calling a local method for updating the database and passing all the parameters to this method.
Please keep in mind that there are many different ways to update the database using the Grid View control depending on the type of data you are updating and the functionality the user need and there are many solutions to achieve the same end result.
In the above tutorial I tried to give you one of the easiest solutions and I hope you can go explore Grid View control editing further after learning the basics from this tutorial.
NET page that will handle different Grid View events to provide complete editing functionality.