Rowupdating findcontrol c
This will make sure that Bind Data() method will not fire when you are going to edit, update or delete the record.
In Bind Data() method, I am getting the data from database using Sql objects and specifying the Data Source property of the Grid View to the Pages Data table of the Data Set.
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.
To get the Primary key, I have used Data Keys property of the Grid View with the index of the row, being edited and stored into a integer variable after parsing.
Now I have declared a Grid View Row variable named row and stored the current row being edited into it.
Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View.
To populate the Grid View, I am calling Bind Data() method from Page_Load event after checking Is Post Back property of the page, so the Grid View will only be populated when there is no postback on the page (when the page loads for the first time).