Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

How to get Hidden Column Value in GridView

3.00/5 (1 vote)
18 Jun 2010CPOL 11.7K  
Alternative way for 1B, this one is way faster :) : protected void btnSelect_Click(object sender, EventArgs e) { Button btn = (Button)sender; DataControlFieldCell dfc = (DataControlFieldCell)btn.Parent; GridViewRow gvr =...
Alternative way for 1B, this one is way faster :) :

protected void btnSelect_Click(object sender, EventArgs e)
{

    Button btn = (Button)sender;
    DataControlFieldCell dfc = (DataControlFieldCell)btn.Parent;
    GridViewRow gvr = (GridViewRow)dfc.Parent;
    Label lblAddressId = (Label) gvr.FindControl("lblAddressId");

    int iAddressId = (int)  lblAddressId.Text;
    lstAddressId.Add(iAddressId);

}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)