Get datakeynames value rowupdating event

So far so good, this all works, the grid is displayed, the Drop Down List appears, filled with the correct data, shows the correct initial item and lets the user select another. The when trying to get the value from the Drop Down List in the Row Updating event, I cant find it. I create a Recursive Find Control method that ran through every control on the page, and it cant find it.

Ive tried peeking in the cell controls in the debugger and its just not there. Ive duplicated it in a simpler test page, with a test database.

Now I am try to update the row form the inner grid-view.

In this example, I am going to retrieve values from categories table of Northwind database. Drag a Grid View into the Web Form and assign Data Key Names property with the primary key column i.e. In the gdview_Row Editing and gdview_Row Deleting event, we have used the below code to retrieve categoryid from datakey of Grid View, int catid = int.

Database Table Structure We are using an "EMPLOYEE" table so the "EMPLOYEE" table design is: Design of Grid View We design a Grid View with which we can perform update and delete operations.

Here we can update Name, Emp_Code and Emp_Age fields depending on the Id field of the "EMPLOYEE" table.

What seems to happen is 'Grid View1_Row Updating' gets fired, at this point new English, new French, and new German all have the new values as they are passed into 'Logic. Then the update functions updates correctly, but once the 'Grid View1_Row Updating' sub ends, it seems to call Logic.

Update another time, and this is where the new values get lost for French and German (datakeys) but not English.

Leave a Reply