ASP.NET 2.0 - set Textbox1 to a Value from GridView1 using Button1

Discussion in 'ASP .Net Web Controls' started by Jado, Aug 25, 2005.

  1. Jado

    Jado Guest

    Hi

    I'm looking at asp.net for the first time after downloading ASP.NET 2.0 VWD
    Beta2. I got off to a good start but i've really been stuggling to answer
    this myself.

    in default.aspx i have GridView1 using sqlDataSource1 which contains a field
    called "au_lname". This field is not a primaryKey.

    below the GridView1 control is TextBox1 and Button1

    in default.aspx.vb i want Button1_OnClick to set the value of TextBox1 to
    the value of "au_lname" in the GridView1 control or sqlDataSource1 Control
    (which ever is possible or the most appropiate).

    unforfunately i don't have exactly what i've been trying out to hand, but
    i've tried something like this..

    Sub Button1_OnClick(..etc..)
    TextBox1.Text = GridView1.TemplateControl("au_lname").ToString
    or
    TextBox1.Text = GridView1.SelectedRow.DataItem("au_lname").ToString
    End Sub

    If someone could provide a solution, that would be great. If i'm way off
    the mark, could you please include some comments to put me on the right
    track.

    Thanks

    Jado
     
    Jado, Aug 25, 2005
    #1
    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. Replies:
    2
    Views:
    382
  2. Replies:
    1
    Views:
    1,046
    =?Utf-8?B?TWFuaXNoIEJhZm5h?=
    Feb 4, 2007
  3. S_K
    Replies:
    1
    Views:
    854
    Alexey Smirnov
    Oct 18, 2007
  4. =?Utf-8?B?cm9kY2hhcg==?=

    TextBox1 value

    =?Utf-8?B?cm9kY2hhcg==?=, Nov 12, 2007, in forum: ASP .Net
    Replies:
    9
    Views:
    442
    =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?=
    Nov 16, 2007
  5. Jado
    Replies:
    0
    Views:
    139
Loading...

Share This Page