Friday, October 31, 2014

How to get the DataKey value in RowDataBound event for GridView



Please try with following code.
protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string lsDataKeyValue = GridView3.DataKeys[e.Row.RowIndex].Values[0].ToString();
        }
    }

No comments:

MS in Computer Science with paid training in USA company