how to get text of a control in itemtemplate of gridview

D

Dinu

Hi

how to get text of a control in itemtemplate of gridview and
how can we access and set it properties dynamycally??

Thanks
 
G

Guest

Hi

how to get text of a control in itemtemplate of gridview and
how can we access and set it properties dynamycally??

Thanks

You can use the FindControl() method

Sample code:

foreach (GridViewRow r in GridView1.Rows)
{
string tb = ((TextBox)r.FindControl("TextBox1")).Text;
}
 
D

Dinu

You can use the FindControl() method

Sample code:

foreach (GridViewRow r in GridView1.Rows)
{
string tb = ((TextBox)r.FindControl("TextBox1")).Text;



}- Hide quoted text -

- Show quoted text -

hi

i have a gridview and a linkbutton in itemtemplate of that gridview,
and the linkbutton is bounded to database.
now what i want is when a user click on linkbutton i want to navigate
accordingly
to the text of linkbutton and i dont want to use select column, so how
can i find that
which linkbutton is clicked??

please help me in this scenario

Thanks & Regards
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top