But ensure that the control/link is inside the Grid View, only then can we cast sender as Grid View.This code is a bit complex but just add it knowing that we may refer to it in the future.This article explains how to perform insert, update and delete operations in ASP. Let us take an example to perform CRUD operations using Entity Framework Database First approach.
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.
Next event is the Grid View Row Editing event to give ASP. You need to set the Edit Index property of the Grid View with the New Edit Index property of the Grid View Edit Event Args class.
If user clicks the Cancel button while Grid View is in editing mode, you need to Cancel the Editing process and also need to reset the Edit Index property to -1 in the Row Canceling Edit event of the Grid View control as shown below: The last step is to handle the Row Updating event to actually update the back end database.
Here in Grid View, in the beginning the major part is to make the decision of putting either a bound field or a template field and the answer is simple: When we want to place any control inside the Grid View then we can go for template field, otherwise bound field will be simpler.
I hope the above information was a little bit helpful for you, kindly let me know your valuable feedback or thoughts.