MvcSiteMapProvider2 - menu not appearing

Jul 9, 2010 at 8:41 AM

Hi,

 

I am new to MVC development and just started exploring the various features. I am trying to use MvcSiteMapProvider2 but menu is not appearing. Following are steps I have followed, please correct me and let me know what I am missing-

 

1. Added the following code somewhere in the <system.web> section:
<system.web>
  <!--For Multiple sitemaps based on users role  -->
    <siteMap defaultProvider="MvcSiteMapProvider" enabled="true">
      <providers>
        <clear />
        <add name="MvcSiteMapProvider"
             type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider"
             siteMapFile="~/BCAAdmin.Sitemap"
             securityTrimmingEnabled="true"
             enableLocalization="true"
             scanAssembliesForSiteMapNodes="true"
             skipAssemblyScanOn=""
             attributesToIgnore="bling"
             nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider"
             controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider"
             actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider"
             aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider"
         />
       
      </providers>
    </siteMap>

 

2. Download MvcSiteMapProvider 2.0.0.zip from codeplex and added reference to DLL in project such that bin folder contains MvcSiteMapProvider.dll

 

3. Created simple sitemap XML file that can be used with the MvcSiteMapProvider:

 

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-2.0" enableLocalization="true">
  <mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="Master" controller="Master" action="Index">
      <mvcSiteMapNode title="Maintenance" controller="type" action="Index" />
    </mvcSiteMapNode>   
    <mvcSiteMapNode title="Commission Master" controller="CommMaster" action="Index" />
    <mvcSiteMapNode title="Commission Approval" controller="CommApproval" action="Index" />
  </mvcSiteMapNode>
</mvcSiteMap>

 

4. In \Views\Shared\Site.Master put the code

 

                 <asp:ContentPlaceHolder ID="ContentPlaceHolder_Header" runat="server">
                    <table cellSpacing="0" cellPadding="0" border="0" width="100%">
                        <tr>
                            <td>     
                                <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" SiteMapProvider="MvcSiteMapProvider" />

                                <asp:Menu ID="Menu2" CssClass="MenuNormal" Width="100%" Height="20px" ItemWrap="true" style="vertical-align:top"  DataSourceID="SiteMapDataSource1"  Orientation="Horizontal" StaticEnableDefaultPopOutImage="false" DynamicEnableDefaultPopOutImage="False">
                                    <StaticMenuStyle CssClass="MenuSmall" />
                                    <StaticMenuItemStyle CssClass="MenuSmall" />
                                    <StaticHoverStyle CssClass="StaticHoverStyle"/>
                                    <StaticSelectedStyle CssClass="MenuSmall"  />
                                    <DynamicMenuStyle CssClass="contentMenuDynamic" />
                                    <DynamicMenuItemStyle CssClass="MenuSmall"   />
                                    <DynamicSelectedStyle CssClass="MenuSmall" />
                                    <DynamicHoverStyle CssClass="DynamicHoverStyle" />
                                   
                                </asp:Menu>
                            </td>      
                        </tr>
                    </table>
                </asp:ContentPlaceHolder> 

 

What more do I need to do to see the menu? I even tried

<%=Html.menu %> but of no use. Please guide me on what I am missing

Thanks

Hari 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Coordinator
Jul 20, 2010 at 7:35 AM

Are you using the latest helpers? i.e. <%=Html.MvcSiteMap().Menu()%> ?