Click here to Skip to main content
14,773,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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="" >

    <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 url="~/Production.aspx" title="Production" description="Productions" />
        <siteMapNode url="~/HR.aspx" title="Human Resources" description="HR" />


... 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 ;)
Updated 25-Aug-10 9:25am
Ankur\m/ 25-Aug-10 7:44am
Edited for formatting.
Ankur\m/ 25-Aug-10 7:45am
With the code you have provided, it should work. I copy pasted your code and it's working fine for me.

Following is the correct code:

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

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

The following code is missing in the example you provided:

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

Like what Ankur mentioned, I also was able to run the code and also got the menu in the web browser.
Ankur\m/ 25-Aug-10 8:23am
But if you don't include this line, it should give an error when you run the webpage.
Al-Farooque Shubho 25-Aug-10 8:38am
Yes, correct. I was able to run the code and the menu appears without any problem. Don't know what is the problem in his case.
Ankur\m/ 25-Aug-10 8:40am
That's what I tried and was successful too. Anyways no replies have been received from OP yet, so I guess the issue is solved.
Dalek Dave 25-Aug-10 10:36am
Good Call.
I had this part of code in markup file, too.
asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />

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:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900