Thursday 5 July 2012

Get value from datakeys in gridview

Simple method to get value from datakeys in gridview


LinkButton lb = (LinkButton)e.CommandSource;
GridViewRow gvr = (GridViewRow)lb.NamingContainer;
int id = (int)grid.DataKeys[gvr.RowIndex].Value;

No comments:

Post a Comment