how to get text of a control in itemtemplate of gridview

Discussion in 'ASP .Net' started by Dinu, Aug 8, 2007.

  1. Dinu

    Dinu Guest

    Hi

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

    Thanks
    Dinu, Aug 8, 2007
    #1
    1. Advertising

  2. On Aug 8, 11:27 am, Dinu <> 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;
    }
    Alexey Smirnov, Aug 8, 2007
    #2
    1. Advertising

  3. Dinu

    Dinu Guest

    On Aug 8, 2:48 pm, Alexey Smirnov <> wrote:
    > On Aug 8, 11:27 am, Dinu <> 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
    Dinu, Aug 8, 2007
    #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. Bennett Haselton
    Replies:
    1
    Views:
    5,317
    Joe Fallon
    Sep 24, 2004
  2. ABC
    Replies:
    1
    Views:
    942
    Patirck Ige
    Oct 7, 2005
  3. =?Utf-8?B?RGFiYmxlcg==?=

    use data from second sqldatasource in gridview itemtemplate?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 20, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    4,046
    =?Utf-8?B?RGFiYmxlcg==?=
    Mar 21, 2006
  4. Keithb
    Replies:
    0
    Views:
    2,881
    Keithb
    Nov 4, 2006
  5. Edwin Knoppert
    Replies:
    0
    Views:
    318
    Edwin Knoppert
    Nov 17, 2006
Loading...

Share This Page