DataBinder.Eval Question

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
I have a form that has two source tables. One is the main informatin that I get the data from and have standard databinding set up on. The second table is the parent table of the first. I use it to categorize what I'm looking at, I custom bound it as shown:

<asp:DropDownList id=cmbCategories EnableViewState="True" Width="180px" Runat="server" DataSource="<# categories #>" DataValueField="ID" DataTextField="LibName" AutoPostBack="True"></asp:DropDownList>

This control is kept in the header of my DataList that is why I have custom bound it, the data list itself is bound to the other table.

The categories table also has a description field. What I want is basically when the person change the drop down list the page refreshes with information from that category - which I have working fine, BUT on the left of the drop down list I want that description shown, this is where I'm having the issue, so I have the following:

<%# DataBinder.Eval(cats, "LibDescription") %>

However that results in the cats does not exist in the namespace blah blah blah.

That's fine, DataBinder wasn't meant to be used that way...or I don't know the correct syntax. Is there another control that exposes the DataSource property that is similiar to a label or a text box? How can I accomplish what I am trying to do?
 
Back
Top