I changed the 0 to a 5 and it worked. (i.e., DataBinder.Eval(DataSet12, "Tables[Customers].DefaultView.[5].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).
Code:
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
SqlDataAdapter1.Fill(DataSet12.Customers)
DataBinder.Eval(DataSet12, "Tables[Customers].DefaultView.[" & i & "].City")
DataBind()
End If
End Sub
What should I be doing? I want to be able to enter a value on the form, and go to that record using databinding.
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.
Bookmarks