column. When a user changed the dropdownlist selection
I needed to update the record. Problem is the row was not selected so
how do I get the datakey?
On selected index changing you do it like this:
DropDownList myDropDown = (DropDownList)sender;
GridViewRow myRow = (GridViewRow)myDropDown.Parent.Parent;
String myDataKey =
Convert.ToString(myGridView.DataKeys[myRow.RowIndex].Value);
Now you can go do your updates, delete or whatever.

No comments:
Post a Comment