Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to get text of a control in itemtemplate of gridview

Reply
Thread Tools

how to get text of a control in itemtemplate of gridview

 
 
Dinu
Guest
Posts: n/a
 
      08-08-2007
Hi

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

Thanks

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-08-2007
On Aug 8, 11:27 am, Dinu <visitd...@gmail.com> wrote:
> 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;
}

 
Reply With Quote
 
 
 
 
Dinu
Guest
Posts: n/a
 
      08-08-2007
On Aug 8, 2:48 pm, Alexey Smirnov <alexey.smir...@gmail.com> wrote:
> On Aug 8, 11:27 am, Dinu <visitd...@gmail.com> wrote:
>
> > 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;
>
>
>
> }- 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Pass control in gridview itemtemplate to function Edwin Knoppert ASP .Net 0 11-17-2006 02:33 PM
Gridview control will not wrap text in ItemTemplate Labels Keithb ASP .Net 0 11-04-2006 12:28 AM
How to identify which row to be selected in itemtemplate column under gridview? ABC ASP .Net 1 10-07-2005 06:12 AM
can code inside a Repeater's ItemTemplate modify controls in the ItemTemplate? Bennett Haselton ASP .Net 1 09-24-2004 01:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57