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

M

Miguel Dias Moura

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
 
A

aarif.shah

Miguel said:
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
 
Joined
Apr 14, 2011
Messages
1
Reaction score
0
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'.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top