Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > ASP.NET 2.0 - set Textbox1 to a Value from GridView1 using Button1

Reply
Thread Tools

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

 
 
Jado
Guest
Posts: n/a
 
      08-24-2005
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").ToStrin g
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


 
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
TextBox1 value =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 9 11-16-2007 03:43 PM
In a GridView how do you search for an item and set the GridView1.PageIndex accordingly? S_K ASP .Net 1 10-18-2007 06:06 PM
RaiseCallbackEvent Server Controls Such as TextBox1.Text value remains empty emailseshu@gmail.com ASP .Net 1 02-04-2007 03:58 AM
Textbox1.Text wont display Value dbfrey@gmail.com ASP .Net 2 08-21-2006 11:07 AM
ASP.NET 2.0 - set Textbox1 to a Value from GridView1 using Button1 Jado ASP .Net Web Controls 0 08-25-2005 08:16 AM



Advertisments