Start C gridview rowupdating not firing

C gridview rowupdating not firing

In practical scenario you should use your existing architecture to populate and update the data.

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.

When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.

As there is no row at -1 position so Grid View will be shown in normal mode.

When Update link of the Grid View will be clicked (in edit mode), On Row Updating event will fire that will call Update Record method.

In this method, we have to get changed values of Text Box and Drop Down list and also we need the primary key value for the record that is being edited.

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 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.