can anybody explane why this dose not work? is it posible to do it diffrently?
DropDownList1.DataValueField = "Vidskiptamadur.Heiti";
List l = session.CreateQuery("from PontunLinur v where v.Vidskiptamadur.Kennitala = '5002696779'").SetMaxResults(10).List();
//This dosen't work
DropDownList1.DataValueField = "Vidskiptamadur.Heiti";
//This works
DropDownList1.DataTextField = "id";
DropDownList1.DataSource = l;
DropDownList1.DataBind();
//This works
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate >
<%# Eval("Vidskiptamadur.Heiti")%><br />
</ItemTemplate>
</asp:Repeater>
Code:
My classes
public class Pontun
{
private string id;
private DateTime dagsetning;
private Vidskiptamadur vidskiptamadur;
private Midill midill;
public virtual Midill Midill
{
get { return midill; }
set { midill = value; }
}
public virtual Vidskiptamadur Vidskiptamadur
{
get { return vidskiptamadur; }
set { vidskiptamadur = value; }
}
public virtual string Id
{
get { return id; }
set { id = value; }
}
public virtual DateTime Dagsetning
{
get { return dagsetning; }
set { dagsetning = value; }
}
}
public class Midill
{
private string id;
private string heiti;
private int tegund;
public virtual string Id
{
get { return id; }
set { id = value; }
}
public virtual string Heiti
{
get { return heiti; }
set { heiti = value; }
}
public virtual int Tegund
{
get { return tegund; }
set { tegund = value; }
}
}
thanks, Siggi