我有一個複雜的類,這是一樣的東西:綁定列表<MyObject>到中繼
public class Person
{
public int Pid;
IList<Address> Addressess;
public Name Name;
public Name PartnerName;
Person(int id)
{
Addressess = new List<Address>();
}
}
public class Address
{
public string HouseName;
public string street;
public string country;
public string universe;
public string galaxy;
}
public class Name
{
public string Firstname;
public string Lastname;
public string Fullname { get { return Firstname + " " + Lastname; } }
}
所以,現在,當我綁定的中繼器,像這樣:
rpPeople.DataSource = PeopleNearYou; //this is a List<Person>();
,並在實際的中繼,我想展示細節。要訪問,比方說,Pid
,所有我需要做的是:
<%# Eval("Pid") %>
現在,我無法弄清楚如何在中繼
<%# Eval("Fullname") %> //error, fullname not found
也獲得全名,我想顯示只有首先解決僅,我不能這樣做,
<%# Eval("Address").First().Universe %> //red, glarring error. can't figure out how
所以,我將如何顯示這些東西嗎?
非常感謝。
看起來不錯,會嘗試 – LocustHorde