Tuesday, February 7, 2012

To retrieve the values from a DataKeyNames collection

To retrieve the values from a DataKeyNames collection, you can use the following things. You can use the following code to get the DataKeys.



Here, You can input multiple values for DataKeyNames by separating with comma (‘,’). For example, DataKeyNames="ProductID,ItemID,OrderID"
You can now access each of DataKeys by providing its index like below:
string ProductID = gvNoteSheet.DataKeys[gvr.RowIndex].Values[0].ToString();
string ItemID = gvNoteSheet.DataKeys[gvr.RowIndex].Values[1].ToString();
string OrderID = gvNoteSheet.DataKeys[gvr.RowIndex].Values[2].ToString();

No comments:

Post a Comment