How to access and bind a label inside a GridView Template Field?

Discussion in 'ASP .Net' started by Miguel Dias Moura, Feb 17, 2006.

  1. Hello,

    I have a GridView in my page with a TemplateField and an Asp Label
    inside it.
    I need to access that Label in runtime and change the field to which it
    is binded.

    Can someone please tell me how to do this?

    Thanks,
    Miguel
     
    Miguel Dias Moura, Feb 17, 2006
    #1
    1. Advertising

  2. Miguel Dias Moura

    Guest

    Miguel Dias Moura wrote:
    > Hello,
    >
    > I have a GridView in my page with a TemplateField and an Asp Label
    > inside it.
    > I need to access that Label in runtime and change the field to which it
    > is binded.
    >
    > Can someone please tell me how to do this?
    >
    > Thanks,
    > Miguel


    Hi Miguel,

    U know what ? i am facing same kinda problem in which i need to remove
    one of the control (either textbox or dropdownlistbox bound to a same
    parameter field) on the click of the edit link of gridview
     
    , Mar 8, 2006
    #2
    1. Advertising

  3. Miguel Dias Moura

    Yamini

    Joined:
    Apr 14, 2011
    Messages:
    1
    puzzled ....

    me too facing the same problem. :sad:
    i want to access value of template field vid label in it.
    so that i can update the database putting that value as filter. but i m unable to do so.
    what i m doing is :-
    Label k= ((Label)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]);
    n gt runtime error :-
    Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.Label'.
     
    Yamini, Apr 14, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=

    RE: bind dropdown field in GridView EditItemTemplate?

    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=, Mar 21, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    9,771
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Mar 21, 2006
  2. =?Utf-8?B?RGFiYmxlcg==?=

    bind dropdown field in GridView EditItemTemplate?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 21, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    30,152
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Mar 23, 2006
  3. Yog
    Replies:
    0
    Views:
    1,620
  4. Sound
    Replies:
    2
    Views:
    480
    Randy Webb
    Sep 28, 2006
  5. Knut Krueger
    Replies:
    8
    Views:
    308
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page