Click here to Skip to main content
15,901,035 members
Articles / Web Development / ASP.NET
Alternative
Tip/Trick

How to get Hidden Column Value in GridView

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
18 Jun 2010CPOL 11.4K   1   1
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)


Written By
Unknown
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralHi Is there any possibility to get item template information... Pin
Member 445197619-Jan-12 8:15
Member 445197619-Jan-12 8:15 
Hi Is there any possibility to get item template information and change the header text

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.