中继器内的中继器(基于ajax的wepapp)

发布于 2024-09-07 06:09:02 字数 1344 浏览 0 评论 0原文

对于解决方案,我不能使用任何回发方法,因为这都是通过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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

画骨成沙 2024-09-14 06:09:02

试试这个:

DataBinder.Eval(((RepeaterItem)Container.Parent.Parent).DataItem,
“网址”)

关键是回到父中继器项,然后使用 eval 方法。

Try this:

DataBinder.Eval(((RepeaterItem)Container.Parent.Parent).DataItem,
"URL")

The key is to work your way back up to the parent repeater item, and then use the eval method.

只为守护你 2024-09-14 06:09:02

实际上当然不是。
我几乎有相同的,但内部转发器数据源设置为 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文