Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
.NET
.NET Assemblies
.NET Core
.NET Standard
Active Directory
ADO.NET
Agile Development
AJAX
Alexa Skills
Algorithms in C#
Android
Angular
Architecture
ArcObject
Artificial Intelligence
ASP.NET
ASP.NET Core
Augmented Reality
Aurelia
AWS
Azure
Backbonejs
Big Data
BizTalk Server
Blockchain
Bootstrap
Bot Framework
Business
C#
C# Corner
C, C++, MFC
Career Advice
Chapters
CIO
Cloud
COBOL.NET
Coding Best Practices
Cognitive Services
COM Interop
Compact Framework
Cortana Development
Cryptocurrency
Cryptography
Crystal Reports
Current Affairs
Custom Controls
Cyber Security
Data Mining
Databases & DBA
Design Patterns & Practices
DevOps
DirectX
Dynamics CRM
Enterprise Development
Entity Framework
Error Zone
Exception Handling
Expression Studio
F#
Files, Directory, IO
Games Programming
GDI+
General
Generative Engine Optimization (GEO)
Google Cloud
Google Development
Graphics Design
Hardware
Hiring and Recruitment
HoloLens
How do I
HTML 5
Internet & Web
Internet of Things
Ionic
iOS
Java
Java and .NET
JavaScript
JQuery
JSON
JSP
Knockout
kotlin
Leadership
Learn .NET
LightSwitch
LINQ
Machine Learning
Microsoft 365
Microsoft Office
Microsoft Phone
Mobile Development
Multithreading
Nano Banana
NetBeans
Networking
Node.js
Office Development
OOP/OOD
Open Source
Operating Systems
Oracle
Outsourcing
Philosophy
PHP
Power BI
Printing in C#
Products
Progressive Web Apps
Project Management
Python
Q#
QlikView
R
React
Reports using C#
Robotics & Hardware
Ruby on Rails
Salesforce
Security
Servers
SharePoint
SignalR
Silverlight
Smart Devices
Software Testing
SQL Language
SQL Server
Startups
String in C#
Swift
TypeScript
Unity
UWP
Visual Basic .NET
Visual Studio
WCF
Wearables
Web Development
Web Services
Web3
Windows 10
Windows Controls
Windows Forms
Windows PowerShell
Windows Services
Workflow Foundation
WPF
Xamarin
XAML Standard
XML
XNA
XSharp
Register
Login
1
Answer
How to configure the multiple sitemaps in one website-menu
ramesh rammi
8y
316
0
1
Others
Reply
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.
Post
Reset
Cancel
Answers (
1
)
Related Discussion