中继器内的中继器(基于ajax的wepapp)
对于解决方案,我不能使用任何回发方法,因为这都是通过ajax完成的。该解决方案需要在asp.net代码中实现。
我有一个 List
,其中包含链接列表(List)
,我需要所有链接来绑定重复信息,例如页面标题、id ,网址。这是我现在的中继器。
<div id="result">
<asp:Repeater runat="server" id="results">
<Itemtemplate>
<asp:Repeater runat="server" datasource='<%# Eval("Links") %>'>
<Itemtemplate>
<tr class="gradeX odd">
<td><%# Eval("Id") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("Title") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("Url") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("URL") %></td>//Property of Link
<td><%# Eval("URLType") %></td> //Property of Link
<td><%# Eval("URLState") %></td> //Property of Link
</tr>
</Itemtemplate>
</asp:Repeater>
</Itemtemplate>
</asp:Repeater>
</div>
当然这不起作用,我该怎么做呢?
感谢您的帮助!
For the solution, I cannot use any postback methods, because this is all working through ajax. The solution need to be implemented in the asp.net code.
I have a List<WebPage>
that contains a list of Links (List<Link>)
and I need for all the links to bind repetitive information such as page title, id, url. Here is my current repeater.
<div id="result">
<asp:Repeater runat="server" id="results">
<Itemtemplate>
<asp:Repeater runat="server" datasource='<%# Eval("Links") %>'>
<Itemtemplate>
<tr class="gradeX odd">
<td><%# Eval("Id") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("Title") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("Url") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("URL") %></td>//Property of Link
<td><%# Eval("URLType") %></td> //Property of Link
<td><%# Eval("URLState") %></td> //Property of Link
</tr>
</Itemtemplate>
</asp:Repeater>
</Itemtemplate>
</asp:Repeater>
</div>
of course this doesnt work, how can i do this?
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
关键是回到父中继器项,然后使用 eval 方法。
Try this:
The key is to work your way back up to the parent repeater item, and then use the eval method.
实际上当然不是。
我几乎有相同的,但内部转发器数据源设置为
DataSource='<%# GetLinks(Container.DataItem) %>'
其中 GetLinks 返回链接的强制枚举
Not of course actually.
I have almost the same, but into inner repeater datasource is set as
DataSource='<%# GetLinks(Container.DataItem) %>'
where GetLinks returns casted enumerable of Links