Results 1 to 4 of 4

Thread: How do I use the databinder.eval programmitically?

  1. #1
    Join Date
    Jul 2004

    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:

    DataBinder.Eval(DataSet12, "Tables[Customers].DefaultView.[0].City")
    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).

        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")
            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 03:07 PM.

  2. #2
    Join Date
    Jul 2004
    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.

  3. #3
    Join Date
    Oct 2004
    Why don't you simply use:

    DataSet12.Text = Tables[Customers][i]["city"]
    Last edited by alon; 11-18-2004 at 01:37 PM.

  4. #4
    Join Date
    Jul 2004
    I was thinking the same thing, also. Have you gotten it to work yet???

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center