ramesh rammi

ramesh rammi

  • NA
  • 86
  • 14k

How to configure the multiple sitemaps in one website-menu

Jan 13 2017 8:40 AM
Actually i had develop the asp.net project.This project has two members
admin,student.i had maintain two master pages with corresponding menu controls for member activities(admin,student).i used two sitemap files (Web.sitemap,student.sitemap)
i was configure the multiple sitemaps in one web configure file.i bind the student member activities to menu control(with in student masterpage)using sitemap but instead of admin activities are bind automatically to student master page i.e functionality second menu not working properly.two master pages are also bind the admin activities but i want to bind the activities for corresponding master pages by using sitemap and menu control.
 
Web.sitemap:
 
  1. <?xml version="1.0" encoding="utf-8" ?>  
  2. <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >  
  3.     <siteMapNode url="" title=""  description="">  
  4.          <siteMapNode url="Admin.aspx" title="Home"  description="Home page" />  
  5.         <siteMapNode url="StudentRegistration.aspx" title="Student registration"  description="Studentregistration page" />  
  6.          <siteMapNode url="AddLearningmaterial.aspx" title="Add material" description="AddLearningmaterial">  
  7.              <siteMapNode url="Alphabets.aspx" title="Alphabets" description="Alphabets page"></siteMapNode>  
  8.              <siteMapNode url="Numbers.aspx" title="Numbers" description="Numbers page"></siteMapNode>  
  9.              <siteMapNode url="Animals.aspx" title="Animals" description="Animals page"></siteMapNode>  
  10.              <siteMapNode url="Fruits.aspx" title="Fruits" description="Fruits page"></siteMapNode>  
  11.              <siteMapNode url="Vegetables.aspx" title="Vegetables" description="Vegetables page"></siteMapNode>  
  12.          </siteMapNode>  
  13.         <siteMapNode url="Modifyingmaterial.aspx" title="Update material" description="Modifyingmaterial page"></siteMapNode>  
  14.     <!--<siteMapNode siteMapFile="student.sitemap"/>-->        
  15.     </siteMapNode>  
  16. </siteMap>  
 student.sitemap:
 
  1. <?xml version="1.0" encoding="utf-8" ?>  
  2. <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >  
  3.  <siteMapNode url="" title=""  description="">  
  4.   <siteMapNode url="Home.aspx" title="Home"  description="Home page" />  
  5.   <siteMapNode url="Viewmaterial.aspx" title="View material"  description="Viewmaterial page" >  
  6.     <siteMapNode url="ViewAlphabets.aspx" title="Alphabets" description="Alphabets page"></siteMapNode>  
  7.     <siteMapNode url="viewNumbers.aspx" title="Numbers" description="Numbers page"></siteMapNode>  
  8.     <siteMapNode url="viewAnimals.aspx" title="Animals" description="Animals page"></siteMapNode>  
  9.     <siteMapNode url="viewFruits.aspx" title="Fruits" description="Fruits page"></siteMapNode>  
  10.     <siteMapNode url="viewVegetables.aspx" title="Vegetables" description="Vegetables page"></siteMapNode>  
  11.    </siteMapNode>  
  12.     </siteMapNode>  
  13. </siteMap>  
   Configure multiple site maps in webconfig File:
 
  1. <?xml version="1.0"?>  
  2. <!--  
  3.   For more information on how to configure your ASP.NET application, please visit  
  4.   http://go.microsoft.com/fwlink/?LinkId=169433  
  5.   -->  
  6. <configuration>  
  7.   <system.web>  
  8.     <siteMap defaultProvider="SiteMapDataSource1">  
  9.       <providers>  
  10.         <clear/>  
  11.        <add name="SiteMapDataSource1" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap" />  
  12.     <add name="SiteMapDataSource2" type="System.Web.XmlSiteMapProvider" siteMapFile="student.sitemap" />  
  13.       </providers>  
  14.     </siteMap>  
  15.     <compilation debug="true" targetFramework="4.5"/>  
  16.     <httpRuntime targetFramework="4.5"/>  
  17.   </system.web>  
  18. </configuration>  
 Admin.master:
 
  1. <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Admin.master.cs" Inherits="Admin" %>  
  2.   
  3. <!DOCTYPE html>  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8.  <style type="text/css">  
  9.     body  
  10.     {  
  11.         font-family: Arial;  
  12.         font-size: 10pt;  
  13.     }  
  14.     .main_menu  
  15.     {  
  16.         width:240px;  
  17.         font-size:x-large;  
  18.         background-color: #8AE0F2;  
  19.         color: #000;  
  20.         text-align: center;  
  21.         height: 30px;  
  22.         line-height: 30px;  
  23.         margin-right: 5px;  
  24.     }  
  25.     .level_menu  
  26.     {  
  27.         width:257px;  
  28.         font-size:large;  
  29.         background-color: #000;  
  30.         color: #fff;  
  31.         text-align: center;  
  32.         height: 30px;  
  33.         line-height: 30px;  
  34.         margin-  
  35.     }  
  36.   
  37.     .selected  
  38.     {  
  39.         background-color: #852B91;  
  40.         color: #fff;  
  41.     }  
  42.     /*.sub_menu 
  43.    { 
  44.         width: 110px; 
  45.         background-color: #000; 
  46.         color: #fff; 
  47.         text-align: center; 
  48.         height: 30px; 
  49.         line-height: 30px; 
  50.         margin- 
  51.    } 
  52.     .hover_menu 
  53.    { 
  54.         background-color: #990000; 
  55.         color:#fff; 
  56.    } 
  57.     .selected_menu 
  58.    { 
  59.       background-color: #FF6600; 
  60.    }*/  
  61. </style>  
  62.     <asp:ContentPlaceHolder id="head" runat="server">  
  63.   
  64.     </asp:ContentPlaceHolder>  
  65. </head>  
  66. <body>  
  67.    <form id="form1" runat="server">  
  68.     <asp:Image ID="ImgELearn"  runat="server" AlternateText="E-Learning" Height="202px" ImageUrl="~/Images/Title logo.png" Width="1020px"  />      
  69.        <div class="user">  
  70.            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />  
  71.            <asp:Menu ID="Menu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"  
  72.     OnMenuItemDataBound="OnMenuItemDataBound">  
  73.     <LevelMenuItemStyles>  
  74.         <asp:MenuItemStyle CssClass="main_menu" />  
  75.         <asp:MenuItemStyle CssClass="level_menu" />         
  76.     </LevelMenuItemStyles>  
  77.  <%--<DynamicMenuItemStyle CssClass="sub_menu" />  
  78. <DynamicHoverStyle CssClass="hover_menu" />  
  79. <StaticSelectedStyle CssClass="selected_menu" />  
  80. <StaticHoverStyle CssClass="hover_menu" />--%>  
  81.   
  82. </asp:Menu>  
  83.        </div>    
  84.     <div>  
  85.         <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">  
  86.           
  87.         </asp:ContentPlaceHolder>  
  88.     </div>  
  89.     </form>  
  90. </body>  
  91. </html>  
 Student.master:

 
  1. <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Student.master.cs" Inherits="Student" %>  
  2.   
  3. <!DOCTYPE html>  
  4.   
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8.     <asp:ContentPlaceHolder id="head" runat="server">  
  9.     </asp:ContentPlaceHolder>  
  10. </head>  
  11. <body>  
  12.  <form id="form1" runat="server">  
  13.     <asp:Image ID="ImgELearn"  runat="server" AlternateText="E-Learning" Height="202px" ImageUrl="~/Images/Title logo.png" Width="1020px"  />  
  14.      <div class="data">  
  15.       <asp:SiteMapDataSource ID="SiteMapDataSource2" runat="server" ShowStartingNode="false" />  
  16.          <%--<asp:SiteMapPath ID="SiteMapPath1"  runat="server" PathSeparator=" > " RenderCurrentNodeAsLink="false">  
  17. </asp:SiteMapPath>--%>  
  18.          <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource2" Orientation="Horizontal"  
  19.     OnMenuItemDataBound="OnMenuItemDataBound">  
  20.     <LevelMenuItemStyles>  
  21.         <asp:MenuItemStyle CssClass="main_menu" />  
  22.         <asp:MenuItemStyle CssClass="level_menu" />         
  23.     </LevelMenuItemStyles>  
  24.        </asp:Menu>  
  25.            
  26.      </div>  
  27.    
  28.     <div>  
  29.         <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">  
  30.           
  31.         </asp:ContentPlaceHolder>  
  32.     </div>  
  33.     </form>  
  34. </body>  
  35. </html>  
 This is my code.I think way of developing the project is correct but i felt small
mistake according sitemap,menu control and web.config configuration.if u know,pls correct the code. i don't know what is the xmlsitemap defaultProvider.pls give me about defaultProvider and also give about name attributes in add tag in detail.
i confused name attributes names what i am given.pls check once.help me.

Answers (1)