Asp.net嵌套转发器与List <class> Object绑定

时间:2016-04-08 11:53:06

标签: c# asp.net repeater

我想将嵌套转发器与List对象绑定。 这是我的班级文件

[Serializable]
    public class ApplicationModel
    {
        // here Applition id GUID ,taken as string.
        public string ApplicationId { get; set; }
        public string ApplicationName { get; set; }
        public string Agency { get; set; }
        public string SequenceString { get; set; }
        public List<SequenceModel> SequenceList { get; set; }
        public int status { get; set; }


    }

    [Serializable]
    public class SequenceModel
    {
        public int Sequence { get; set; }
    }

这是我的嵌套转发器。

 <asp:Repeater ID="rptrApplications" runat="server" OnItemCommand="rptrApplications_ItemCommand" OnItemDataBound="rptrApplications_ItemDataBound">
                        <ItemTemplate>
                            <div class="floating">
                                <table>
                                    <tr>
                                        <td class="alignRight">
                                            <label>Agency:</label>

                                        </td>
                                        <td>

                                            <asp:Label ID="lblDisplayAgency" CssClass="alignLeft" runat="server" Text='<%#Eval("Agency")%>'></asp:Label>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="alignRight">
                                            <label>Application #:</label></td>
                                        <td>
                                            <asp:Label CssClass="alignLeft" ID="lblDisplayApplicationName" runat="server" Text='<%#Eval("ApplicationName")%>'></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <asp:Repeater ID="rptrApplicationSequence" runat="server"  OnItemCommand="rptrApplicationSequence_ItemCommand" OnItemDataBound="rptrApplicationSequence_ItemDataBound">
                                            <ItemTemplate>
                                                <tr>
                                                    <td class="alignRight">
                                                        <asp:Label ID="lblAddedSequence" runat="server" Text="Sequence #: "></asp:Label></td>
                                                    <td>
                                                        <asp:Label Style="text-align: left; min-width: 200px;" ID="lblSequence" runat="server" Text='<%# DataBinder.Eval(Container, "SequenceList.Sequence") %>'></asp:Label>
                                                        <asp:ImageButton ID="imgBtnDelSequence" runat="server" Visible="true" OnClientClick="showWaitScreenDialogBox();" CommandName="Delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"[\"ApplicationId\"]") %>' ImageUrl="/Style%20Library/GlobalSubmit/images/colse.png" AlternateText="Delete" />
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </tr>
                                    <tr>
                                        <td class="alignRight">
                                            <asp:Label ID="lblSequence" runat="server" Text="Sequence #: "></asp:Label></td>
                                        <td>
                                            <%-- Text='<%#Eval("tempSequence")%>' --%>
                                            <asp:TextBox ID="txtSequenceAdded" Style="width: 50%;" runat="server"  CommandArgument='<%#Eval("ApplicationId")%>' MaxLength="4"></asp:TextBox></td>
                                    </tr>
                                </table>
                                <center>
                                    <asp:Button ID="btnRemoveApplication"  style="text-align:right" runat="server" Text="Remove Application" onClientclick="showWaitScreenDialogBox();"  CommandName="Delete" CommandArgument='<%#Eval("ApplicationId")%>' CssClass="btnRemove"/>

                                </center>
                                <br />
                            </div>

                        </ItemTemplate>
                    </asp:Repeater>

我收到错误。 DataBinding:&#39; GlobalSubmit.Intranet.Model.SequenceModel&#39;不允许索引访问。

0 个答案:

没有答案