Friday, September 12, 2008

GridView - Get and Set More than one DataKeyNames

To set more than one DataKeys in grid view,

<asp:GridView ID="grdView" runat="server" DataKeyNames="Name,Email">

To get the Value of the DataKey
DataKey myData = grdView.DataKeys[RowIndex++];

myData.Values["StarRate"];

OR

String value = grdView.DataKeys[RowIndex++].Values["StarRate"];

No comments: