Ear*_*rlz 3 c# asp.net data-binding repeater
我正在尝试按照此处所述进行嵌套转发器,但这是错误的.
我的中继器如下:
<asp:Repeater ID="HouseholdRepeater" runat="server">
<ItemTemplate>
<div><b><%# DataBinder.Eval(Container.DataItem,"Name") %></b></div>
<div>
<asp:Repeater ID="ApplicationRepeater" runat="server" DataSource="<%#((DataRowView)Container.DataItem).Row.GetChildrows("Applications") %>"> <!-- error here -->
<ItemTemplate>
<div>
<a href="<%# DataBinder.Eval(Container.DataItem,"Link") %>"><%# DataBinder.Eval(Container.DataItem,"Description") %></a>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</ItemTemplate>
</asp:Repeater>
Run Code Online (Sandbox Code Playgroud)
我得到的错误消息是"服务器标签格式不正确".
它看起来就像我的例子.我没看到它有什么问题.任何想法如何使这项工作?
此外,我使用Linq查询中的匿名对象在代码中对其进行了数据绑定.
您使用双引号来指定DataSource属性,但您的DataSource本身包含双引号.尝试将DataSource封闭在单引号中:
DataSource='<%#((DataRowView)Container.DataItem).Row.GetChildrows("Applications") %>'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
827 次 |
| 最近记录: |