Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 what s good way to bind five textboxes to datarow

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-02-13 : 10:48:31
asp.net 1.1hi,
i have an input textbox, that i provide to a function , the function returns a datarow based on the input textbox. Then I need to fill five textboxes with the columns values of my datarow.
What s a good way to bind the five textboxes to the datarow columns so that whenevr the function returns a new datarow, my textboxes change automatically.
Should I implement the textboxes seperately or in a single-row datagrid.
How do I do the databinding?
Thank you

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-02-13 : 13:40:25
??? You just set the textboxs' Text property:

DataRow dr = yourfunctionThatReturnsADataRow();
TextBox1.text = dr["Column1"].ToString();
TextBox2.text = dr["Column2"].ToString();
TextBox3.text = dr["Column3"].ToString();
..etc..

check for nulls and convert/format your results as appropriate, of course.



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -