TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
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:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
siteMap
xmlns
=
"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"
>
<
siteMapNode
url
=
""
title
=
""
description
=
""
>
<
siteMapNode
url
=
"Admin.aspx"
title
=
"Home"
description
=
"Home page"
/>
<
siteMapNode
url
=
"StudentRegistration.aspx"
title
=
"Student registration"
description
=
"Studentregistration page"
/>
<
siteMapNode
url
=
"AddLearningmaterial.aspx"
title
=
"Add material"
description
=
"AddLearningmaterial"
>
<
siteMapNode
url
=
"Alphabets.aspx"
title
=
"Alphabets"
description
=
"Alphabets page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"Numbers.aspx"
title
=
"Numbers"
description
=
"Numbers page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"Animals.aspx"
title
=
"Animals"
description
=
"Animals page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"Fruits.aspx"
title
=
"Fruits"
description
=
"Fruits page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"Vegetables.aspx"
title
=
"Vegetables"
description
=
"Vegetables page"
>
</
siteMapNode
>
</
siteMapNode
>
<
siteMapNode
url
=
"Modifyingmaterial.aspx"
title
=
"Update material"
description
=
"Modifyingmaterial page"
>
</
siteMapNode
>
<!--<siteMapNode siteMapFile="student.sitemap"/>-->
</
siteMapNode
>
</
siteMap
>
student.sitemap:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
siteMap
xmlns
=
"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"
>
<
siteMapNode
url
=
""
title
=
""
description
=
""
>
<
siteMapNode
url
=
"Home.aspx"
title
=
"Home"
description
=
"Home page"
/>
<
siteMapNode
url
=
"Viewmaterial.aspx"
title
=
"View material"
description
=
"Viewmaterial page"
>
<
siteMapNode
url
=
"ViewAlphabets.aspx"
title
=
"Alphabets"
description
=
"Alphabets page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"viewNumbers.aspx"
title
=
"Numbers"
description
=
"Numbers page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"viewAnimals.aspx"
title
=
"Animals"
description
=
"Animals page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"viewFruits.aspx"
title
=
"Fruits"
description
=
"Fruits page"
>
</
siteMapNode
>
<
siteMapNode
url
=
"viewVegetables.aspx"
title
=
"Vegetables"
description
=
"Vegetables page"
>
</
siteMapNode
>
</
siteMapNode
>
</
siteMapNode
>
</
siteMap
>
Configure multiple site maps in webconfig File:
<?
xml
version
=
"1.0"
?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?
LinkId
=
169433
--
>
<
configuration
>
<
system.web
>
<
siteMap
defaultProvider
=
"SiteMapDataSource1"
>
<
providers
>
<
clear
/>
<
add
name
=
"SiteMapDataSource1"
type
=
"System.Web.XmlSiteMapProvider"
siteMapFile
=
"Web.sitemap"
/>
<
add
name
=
"SiteMapDataSource2"
type
=
"System.Web.XmlSiteMapProvider"
siteMapFile
=
"student.sitemap"
/>
</
providers
>
</
siteMap
>
<
compilation
debug
=
"true"
targetFramework
=
"4.5"
/>
<
httpRuntime
targetFramework
=
"4.5"
/>
</
system.web
>
</
configuration
>
Admin.master
:
<%@ Master Language=
"C#"
AutoEventWireup=
"true"
CodeFile=
"Admin.master.cs"
Inherits=
"Admin"
%>
<!DOCTYPE html>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<title></title>
<style type=
"text/css"
>
body
{
font-family: Arial;
font-size: 10pt;
}
.main_menu
{
width:240px;
font-size:x-large;
background-color: #8AE0F2;
color: #000;
text-align: center;
height: 30px;
line-height: 30px;
margin-right: 5px;
}
.level_menu
{
width:257px;
font-size:large;
background-color: #000;
color: #fff;
text-align: center;
height: 30px;
line-height: 30px;
margin-
}
.selected
{
background-color: #852B91;
color: #fff;
}
/*.sub_menu
{
width: 110px;
background-color: #000;
color: #fff;
text-align: center;
height: 30px;
line-height: 30px;
margin-
}
.hover_menu
{
background-color: #990000;
color:#fff;
}
.selected_menu
{
background-color: #FF6600;
}*/
</style>
<asp:ContentPlaceHolder id=
"head"
runat=
"server"
>
</asp:ContentPlaceHolder>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<asp:Image ID=
"ImgELearn"
runat=
"server"
AlternateText=
"E-Learning"
Height=
"202px"
ImageUrl=
"~/Images/Title logo.png"
Width=
"1020px"
/>
<div
class
=
"user"
>
<asp:SiteMapDataSource ID=
"SiteMapDataSource1"
runat=
"server"
ShowStartingNode=
"false"
/>
<asp:Menu ID=
"Menu"
runat=
"server"
DataSourceID=
"SiteMapDataSource1"
Orientation=
"Horizontal"
OnMenuItemDataBound=
"OnMenuItemDataBound"
>
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass=
"main_menu"
/>
<asp:MenuItemStyle CssClass=
"level_menu"
/>
</LevelMenuItemStyles>
<%--<DynamicMenuItemStyle CssClass=
"sub_menu"
/>
<DynamicHoverStyle CssClass=
"hover_menu"
/>
<StaticSelectedStyle CssClass=
"selected_menu"
/>
<StaticHoverStyle CssClass=
"hover_menu"
/>--%>
</asp:Menu>
</div>
<div>
<asp:ContentPlaceHolder id=
"ContentPlaceHolder1"
runat=
"server"
>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Student.master:
<%@ Master Language=
"C#"
AutoEventWireup=
"true"
CodeFile=
"Student.master.cs"
Inherits=
"Student"
%>
<!DOCTYPE html>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<title></title>
<asp:ContentPlaceHolder id=
"head"
runat=
"server"
>
</asp:ContentPlaceHolder>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<asp:Image ID=
"ImgELearn"
runat=
"server"
AlternateText=
"E-Learning"
Height=
"202px"
ImageUrl=
"~/Images/Title logo.png"
Width=
"1020px"
/>
<div
class
=
"data"
>
<asp:SiteMapDataSource ID=
"SiteMapDataSource2"
runat=
"server"
ShowStartingNode=
"false"
/>
<%--<asp:SiteMapPath ID=
"SiteMapPath1"
runat=
"server"
PathSeparator=
" > "
RenderCurrentNodeAsLink=
"false"
>
</asp:SiteMapPath>--%>
<asp:Menu ID=
"Menu1"
runat=
"server"
DataSourceID=
"SiteMapDataSource2"
Orientation=
"Horizontal"
OnMenuItemDataBound=
"OnMenuItemDataBound"
>
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass=
"main_menu"
/>
<asp:MenuItemStyle CssClass=
"level_menu"
/>
</LevelMenuItemStyles>
</asp:Menu>
</div>
<div>
<asp:ContentPlaceHolder id=
"ContentPlaceHolder1"
runat=
"server"
>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</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.
Reply
Answers (
1
)
Read HTML Embedded .eml files in C#
what scenario using code first or entity framework