Search This Blog

Showing posts with label rowdatabound. Show all posts
Showing posts with label rowdatabound. Show all posts

Thursday, May 6, 2010

I'm always searching for this...

To get the datakey on rowdatabound event for gridviews.


if (e.Row.RowType == DataControlRowType.DataRow)
{
string strY = GridView2.DataKeys[e.Row.RowIndex].Values[1].ToString();
}

The number 1 could be replaced with "KeyName" also.