I have two nested repeaters in my *.aspx page.
<asp:Repeater runat="server" id="rptMain">
<ItemTemplate>
<h1><%#DataBinder.Eval(Container.DataItem, "Name")%></h1>
<asp:Repeater runat="server" DataSource='<%# getUser(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "FieldKey"))) %>'>
<HeaderTemplate><ol></HeaderTemplate>
<ItemTemplate>
<li class="<%#DataBinder.Eval(Container.DataItem, "CSSStyle")%>" id="li<%#DataBinder.Eval(Container.DataItem, "FieldKey")%>">
<%#DataBinder.Eval(Container.DataItem, "NameSubject")%>
</li>
</ItemTemplate>
<FooterTemplate></ol></FooterTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
getUser is a protected method. It must returns the List with the following properties:
- CSSClass
- FieldKey
- NameSubject
But CSSClass property is defined into the anonymous type.
protected List<????> getUser(int id)
{
DataClassesDataContext datacontext = new DataClassesDataContext();
var t1= from t in datacontext.GetAllCustomSubject(id).ToList()
select new { t.NameSubject, t.FieldKey, CSSStyle = t.IsDeleted ? "deleted hidden" : "real visible" };
return t;
}
How can I return such List? What kind of datatype can I Use instead of ???? ? In general, can I use nested repeaters with anonymous types?