Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在listview asp.net c中绑定listview#_C#_Asp.net_.net_Listview - Fatal编程技术网

C# 在listview asp.net c中绑定listview#

C# 在listview asp.net c中绑定listview#,c#,asp.net,.net,listview,C#,Asp.net,.net,Listview,我想在listview中绑定listview。我有一个对象,其中包含另一个对象列表对象 这里我有一个result对象,其中还有一个weeklyresult(List)对象。 我正在尝试将外部列表与结果对象绑定 以下是cs代码: 在resultListobject中填充数据: ResultListView.DataSource = resultList; ResultListView.DataBind();

我想在listview中绑定listview。我有一个对象,其中包含另一个对象列表对象

这里我有一个result对象,其中还有一个weeklyresult(List)对象。 我正在尝试将外部列表与结果对象绑定

以下是cs代码:

在resultListobject中填充数据:

                ResultListView.DataSource = resultList;
                ResultListView.DataBind();
                Response.Write(resultList);
课程结果和每周结果:

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; }
}
类结果{
公共字符串examDate{get;set;}
公共列表weeklyResultList=null;
}
课程周结果{
公共字符串主题{get;set;}
公共双标记包含{get;set;}
公共双输出{get;set;}
}
下面是我的asp.net代码:

<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>

日期:
获得的分数
出去
外部列表中的数据即将出现,但内部列表中没有显示任何内容。 你能告诉我我做错了什么吗

谢谢, Amandeep必须使用:

DataSource='<%#Eval("weeklyResultList")

DataSource='尝试将内部ListView绑定到第一个ListView中。只需分配其他数据源。它只会解决你的问题