I want to bind listview inside the listview. I have an object which contains another object list object inside it.
Here I have result object and I have another weeklyresult(List) object in it. I am trying to bind outer list with the result object.
Here is the cs code:
Populate data in resultListobject :
ResultListView.DataSource = resultList;
ResultListView.DataBind();
Response.Write(resultList);
Classes Result and weeklyresult :
class Result {
public string examDate { get; set; }
public List<WeeklyResult> weeklyResultList = null;
}
class WeeklyResult {
public string subject { get; set; }
public double marksObtained { get; set; }
public double outOff { get; set; }
}
Now here is my asp.net code:
<asp:ListView ID="ResultListView" runat="server">
<ItemTemplate>
<asp:Label runat="server"></asp:Label>
<table id="Table1" runat="server">
<tr>
<td>Date :<%#Eval("examDate")%> </td>
<td>Marks Obtained</td>
<td>Out off</td>
</tr> </table>
<asp:ListView ID="InnerListView" runat="server">
<ItemTemplate>
<asp:Label ID="Label0" runat="server" Text="abc<%#Eval('weeklyResultList.subject')%>"></asp:Label>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
<asp:Label ID="Label3" runat="server" Text=""></asp:Label>
</ItemTemplate>
</asp:ListView>
</ItemTemplate>
</asp:ListView>
The data in the outer list is coming but nothing is getting displayed in the inner list. Can you please suggest what I am doing wrong.
Thanks, Amandeep