views:

114

answers:

1

I have a dropdownlist that gets data through entity objects, but with a navigation. But I get an error trying to do this, can anyone help me please.
<asp:DropDownList ID="ddlVacancy" DataValueField="ID" DataTextField='<%# Eval("Position.Name") %>' runat="server" Width="200px"/>

A: 

You can create a property in your entity object like this:

        public string PositionName
        {
           get
           {
               return Position.Name;
           }
        }

and then replace Eval("Position.Name") with Eval("PositionName")

hope this helps

Matin Habibi