I have a list of objects that contain a composite key because of the legacy database that supports multi-tenancy. How can I then bind that list to a checkbox list in asp.net? We're currently using c# 3.5.
Here's the class:
public class SiteKey
{
public int Id { get; set; }
public int CustomerId { get; set; }
}
public class Order
{
public SiteKey Key { get; set; }
public string Name { get; set; }
}
My repository returns an IList<Order>
that I want to then bind to a checkbox list.
This code:
chkList.DataValueField = "Key";
chkList.DataTextField = "Name";
displays properly, but the value (chkList.Items[0].Value
) coming back simply contains "MyAssemblyName.SiteKey" and not the key.
How can I effectively accomplish this?
Thanks!