在ASP.NET 3.5中使用站点地图菜单 [英] Using menu for sitemap in ASP.NET 3.5

查看:69
本文介绍了在ASP.NET 3.5中使用站点地图菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我不能将菜单用于站点地图.我的项目中有一个站点地图文件和一个母版页.我选择SiteMapDataSource 作为菜单数据源ID,如下所示:

Hi,

I can''t use menu for sitemap. I have a sitemap file and a master page in my project. I choose SiteMapDataSource for menu data source ID, like this:

<asp:Menu ID="Menu1" runat="server"  DataSourceID="SiteMapDataSource1"

            Orientation="Horizontal"   />



带有此站点地图文件的文件:



with this site map file:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

    <siteMapNode  title="Root">
        <siteMapNode url="~/Home.aspx"  title="Home"  description="Home page" />
        <siteMapNode url="~/Sales.aspx" title="Sales"  description="Sales">
            <siteMapNode url="~/Sales_Orders.aspx" title="Orders" description="Orders" />
            <siteMapNode url="~/Sales_Stores.aspx" title="Stores" description="Stores" />
        </siteMapNode>
        <siteMapNode url="~/Production.aspx" title="Production" description="Productions" />
        <siteMapNode url="~/HR.aspx" title="Human Resources" description="HR" />
    </siteMapNode>

</siteMap>



...但是无论何时运行程序,我都看不到菜单的内容.我不知道为什么此数据源未绑定到菜单.

请帮帮我....:doh:

谢谢;)



... but whenever the program is run, I cannot see the content (or items) of the menu. I don''t know why this data source is not bound to the menu.

Help me please.... :doh:

Thanks ;)

推荐答案

以下是正确的代码:

Following is the correct code:

<asp:Menu ID="Menu1" DataSourceID="SiteMapDataSource1" runat="server">
</asp:Menu>

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />



您提供的示例中缺少以下代码:



The following code is missing in the example you provided:

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />



就像Ankur提到的那样,我也能够运行代码,并且还可以在Web浏览器中获得菜单.



Like what Ankur mentioned, I also was able to run the code and also got the menu in the web browser.


我在标记文件中也有这部分代码.
<
I had this part of code in markup file, too.
<
asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />



这不是我的问题,谢谢.
我可以在静态视图(在Designer视图中)中看到菜单,但是
每当我运行它时,内部菜单项都无法正确显示! :sigh:



It is not my problem, thank you any way.
I can see my menu in static view(in Designer view) but
when ever I run it, the inner menu itemes are not display correctly! :sigh:


这篇关于在ASP.NET 3.5中使用站点地图菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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