Click here to Skip to main content
15,212,669 members
Rate this:
Please Sign up or sign in to vote.
See more:
hey !
ive encountered with a amateur , ambiguous issue about asp.net menu control .
i made a web.sitemap file as shown here :
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode title="main">
    <siteMapNode title="Home" description="Home" url="~/default.aspx">
    </siteMapNode>
    <siteMapNode title="Products" description="">
      <siteMapNode title="mobile" description="Our products" url="~/mobile.aspx">
        <siteMapNode title="web based"   url="~/webbased.aspx" />
        <siteMapNode title="windows"   url="~/windows.aspx" />
      </siteMapNode>
    </siteMapNode>
  </siteMapNode>
</siteMap>


and i want a menu control show it horizontally ... i wrote these simple lines :
<div id="Menu" style="padding :20px;">
       <asp:Menu ID="Menu1" Runat="server" 

            DataSourceID="SiteMapDataSource"

            Orientation="Horizontal">
      </asp:Menu>
      <asp:SiteMapDataSource ID="SiteMapDataSource" runat="server"/>
</div>


but it always show items vertically and submenus and parent menus listed as below :
main
Home
Products
mobile
web based
windows


but it should be something like this :
Home Products▼ 


in design time everything is as my wish but when i run it on any browser , menu showed me items as list, menus and submenus in vertically list... it dnt show me horizontally at all !

whats the problem ... can anyone help me?
thanks all to spending time!
Posted
Updated 19-Mar-13 6:33am
v3
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi! Hope this solves your problem!!! i've checked this in my local env. it's working as you expected..

<asp:Menu ID="Menu1" runat="server" orientation="Horizontal" StaticDisplayLevels="2" datasourceid="SiteMapDataSource1">
    </asp:Menu>
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />


and in sitemap file
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="Home" description="Home">
    <siteMapNode title="Home" description="Home" url="~/default.aspx" />
    <siteMapNode title="Products" description="">
      <siteMapNode title="mobile" description="Our products" url="~/mobile.aspx">
        <siteMapNode title="web based"   url="~/webbased.aspx" />
        <siteMapNode title="windows"   url="~/windows.aspx" />
      </siteMapNode>
    </siteMapNode>
  </siteMapNode>
</siteMap>

Ref:http://msdn.microsoft.com/en-us/library/ecs0x9w5(v=vs.80).aspx[^]
Mark it if you find this useful!!
~~SATZ~~
   
v2
Comments
ali_heidari_ 20-Mar-13 16:16pm
   
THANKS MY problem solved ... problem was with my browsers ! i unistall the google chrome and reinstal it ... but with anonymous reason problem solved on all of my browsers!
Rate this:
Please Sign up or sign in to vote.

Solution 1

Did you add provider?... in web.config???

<siteMap>
            <providers>
                <add name="MainWebSitemap" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap" securityTrimmingEnabled="true"/>
            </providers>
</siteMap>


and mapped this to the
<asp:SiteMapDataSource
tag?
   
v2
Comments
ali_heidari_ 19-Mar-13 7:13am
   
problem is not provier... sitemapdatasource will use web.sitemap file as default .... this provider you suggest is default.
anyway i used your advice but resault was as same before. items listed not like a menu with floating submenu .

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100