Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding field to a textbox
Message
From
29/11/2002 18:33:43
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00728265
Message ID:
00728272
Views:
17
Dmitry,

You don't need to create a DataView, you can bind directly to a DataSet's table. For a TextBox, you would bind to the Text property. Something like this:
this.MyTextBox.DataBindings.Add("Text", MyTable, "CustomerID");
This is how to do it programmatically, not from the property sheet.

HTH,
~~Bonnie

>For some reason, all the tech documents and msdn articles like to show examples of binding data to grids but poor textboxes are always forgotten <g>.
>
>My questions are:
>1. Should I create a DataView on a DataTable in DataSet for binding to textboxes? (or I can and should bind directly to DataSet?)
>2. Say I create a dataset dstCustomers in the Page_load method. This dataset has a field CustomerID. What should I enter in the DataBindings property of the textbox txtCustomerId? (If I click on the [...] next to the DataBinings property, I get Data Bindings dialog but I could not see how to assing the field from the dataset there).
>
>TIA
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform