Asp转发器和Sitemap提供商问题 [英] Asp repeater and Sitemap provider issue

查看:61
本文介绍了Asp转发器和Sitemap提供商问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个转发器,它查看站点地图提供程序以获取菜单项。但问题是,它只获得顶级菜单项而没有子菜单项。以下是代码,请告诉我这里做错了什么。谢谢



Hi,
I have a repeater which looks at the sitemap provider to obtain the menu items. But the issue is, it is getting only the top level menu items and no submenu item. Below is the code please let me know what I have done wrong here. Thanks

<ul id="menu">
                   <!-- menu rendering starts here -->
                   <asp:Repeater runat="server" ID="rptrMenu" DataSourceID="SiteMapDataSource1" EnableViewState="False">
                       <ItemTemplate>
                           <li><a href="<%# this.ResolveUrl(Eval("Url") as string) %>"><%# Eval("Title") %></a>
                               <asp:Repeater ID="rptrSubmenu" runat="server" DataSource='<%# ((SiteMapNode)Container.DataItem).ChildNodes %>'>
                                   <HeaderTemplate>
                                       <ul>
                                   </HeaderTemplate>
                                   <ItemTemplate>
                                       <li><a href="<%# this.ResolveUrl(Eval("Url") as string) %>"><%# Eval("Title") %></a>
                                           <asp:Repeater ID="Repeater1" runat="server" DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>'>
                                               <HeaderTemplate>
                                                   <ul>
                                               </HeaderTemplate>
                                               <ItemTemplate>
                                                   <li><a href="<%# this.ResolveUrl(Eval("Url") as string) %>"><%# Eval("Title") %></a></li>
                                               </ItemTemplate>
                                               <FooterTemplate>
                                                   </ul>
                                               </FooterTemplate>
                                           </asp:Repeater>
                                       </li>
                                   </ItemTemplate>
                                   <FooterTemplate>
                                       </ul>
                                   </FooterTemplate>
                               </asp:Repeater>
                           </li>
                       </ItemTemplate>
                   </asp:Repeater>
                   <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />

推荐答案

我相信要内心要转发的转发器,你需要处理ItemDataBinding事件,这样你就可以找到它并调用DataBind。否则,它将无法运行,您将无法获得第二级。
I believe that to get an inner repeater to bind, you need to handle the ItemDataBinding event, so you can find it and call DataBind. Otherwise, it will not run, and you won''t get your second level.


这篇关于Asp转发器和Sitemap提供商问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆