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 Core
.NET MAUI
.NET Standard
Active Directory
ADO.NET
Agile Development
AI
AJAX
AlbertAGPT
Alchemy
Alexa Skills
Algorand
Algorithms in C#
Android
Angular
ArcObject
ASP.NET
ASP.NET Core
Augmented Reality
Avalanche
AWS
Azure
Backbonejs
Big Data
BizTalk Server
Blazor
Blockchain
Bootstrap
Bot Framework
Business
Business Intelligence(BI)
C#
C# Corner
C# Strings
C, C++, MFC
Career Advice
Careers and Jobs
Chapters
ChatGPT
Cloud
Coding Best Practices
Cognitive Services
COM Interop
Compact Framework
Copilot
Cortana Development
Cosmos DB
Cryptocurrency
Cryptography
Crystal Reports
CSS
Current Affairs
Custom Controls
Cyber Security
Data Mining
Data Science
Databases & DBA
Databricks
Design Patterns & Practices
DevExpress
DevOps
DirectX
Dynamics CRM
Enterprise Development
Entity Framework
Error Zone
Exception Handling
F#
Files, Directory, IO
Flutter
Games Programming
GDI+
General
Generative AI
GO
Google Cloud
Google Development
Graphics Design
Graphite Studio
Hardware
Hiring and Recruitment
HoloLens
How do I
HTML 5
Infragistics
Internet & Web
Internet of Things
Ionic
Java
Java and .NET
JavaScript
JQuery
JSON
JSP
Knockout
Kotlin
Langchain
Leadership
Learn .NET
Learn iOS Programming
LINQ
Machine Learning
Metaverse
Microsoft 365
Microsoft Fabric
Microsoft Office
Microsoft Phone
Microsoft Teams
Mobile Development
MongoDB
MuleSoft
MySQL
NEAR
NetBeans
Networking
NFT
NoCode LowCode
Node.js
Office Development
OOP/OOD
Open Source
Operating Systems
Oracle
Outsourcing
Philosophy
PHP
Polygon
PostgreSQL
Power Apps
Power Automate
Power BI
Power Pages
Printing in C#
Products
Progress
Progressive Web Apps
Project Management
Public Speaking
Python
Q#
QlikView
Quantum Computing
R
React
React Native
Reports using C#
Robotics & Hardware
RPA
Ruby on Rails
RUST
Salesforce
Security
Servers
ServiceNow
SharePoint
Sharp Economy
SignalR
Smart Devices
Snowflake
Software Architecture/Engineering
Software Testing
Solana
Solidity
Sports
SQL
SQL Server
Startups
Stratis Blockchain
Swift
SyncFusion
Threading
Tools
TypeScript
Unity
UWP
Visual Basic .NET
Visual Studio
Vue.js
WCF
Wearables
Web API
Web Design
Web Development
Web3
Windows
Windows Controls
Windows Forms
Windows PowerShell
Windows Services
Workflow Foundation
WPF
Xamarin
XAML
XML
XNA
XSharp
Register
Login
1
Answer
How to configure the multiple sitemaps in one website-menu
ramesh rammi
8y
1.9k
1
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
)
Next Recommended Forum
Read HTML Embedded .eml files in C#
what scenario using code first or entity framework