How do I use the databinder.eval programmitically?
I have a textbox bound to the customers table (city field) of the Northwind database. I noticed the custom binding expression:
I changed the 0 to a 5 and it worked. (i.e., DataBinder.Eval(DataSet12, "Tables[Customers].DefaultView..City")).
However, when I do it in the aspx.vb code, it doesn't work. (The textbox is bound to the field, not the custom expression).
What should I be doing? I want to be able to enter a value on the form, and go to that record using databinding.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim i = 5
If Not IsPostBack Then
DataBinder.Eval(DataSet12, "Tables[Customers].DefaultView.[" & i & "].City")
Or, is there a way to include a varible when I use the databinding wizard to connect to the dataset?)
i.e., when I click on textbox, and click the ellipses for the databinding and select the dataset, then a field.
Last edited by MdWebtress; 11-05-2004 at 02:07 PM.
The DataBinder.Eval returns a value, so if you aren't assigning it to anything, it wont work. I've never binded data to a textbox but you could try TextBox.DataSource = DataSet12
That might get you closer to what you need.
Why don't you simply use:
DataSet12.Text = Tables[Customers][i]["city"]
Last edited by alon; 11-18-2004 at 12:37 PM.
I was thinking the same thing, also. Have you gotten it to work yet???
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)