473,695 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Menu Control

I have a master page which contains a Menu control and a SiteMapPath control,
both are bound to the same web.sitemap XML file. Say I have 2 pages, Page 1
and Page 2. Now Page 2 can only be accessed after selecting some information
on Page 1 (using a CrossPagePostba ck). When the user get's to Page 2, the
SiteMapPath control fails to render, obviously because Page 2 isn't in the
web.sitemap file.

If I put Page 2 in the web.sitemap file, it then get's rendered in the Menu
control, which I don't want. So, is there any way to "hide" certain nodes in
a web.sitemap file from the Menu control?

Or is there anyway I can have the SiteMapPath control render properly on
Page 2 whilst not showing it in the Menu control to the user?
Nov 19 '05 #1
4 2672
You're going to have to create a custom SiteMapProvider and override the
IsAccessibleToU ser method to provide your custom display logic. The easiest
way would be to derive from the existing XmlSiteMapProvi der. Fredrik has
some related sample code:

http://fredrik.nsquared2.com/viewpos...wfeedback=true

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have a master page which contains a Menu control and a SiteMapPath
control, both are bound to the same web.sitemap XML file. Say I have 2
pages, Page 1 and Page 2. Now Page 2 can only be accessed after
selecting some information on Page 1 (using a CrossPagePostba ck). When
the user get's to Page 2, the SiteMapPath control fails to render,
obviously because Page 2 isn't in the web.sitemap file.

If I put Page 2 in the web.sitemap file, it then get's rendered in the
Menu control, which I don't want. So, is there any way to "hide"
certain nodes in a web.sitemap file from the Menu control?

Or is there anyway I can have the SiteMapPath control render properly
on Page 2 whilst not showing it in the Menu control to the user?


Nov 19 '05 #2
Thanks for the link.

OK, I've tried to create a class inheriting the StaticSiteMapPr ovider but
only overriding the IsAccessibleToU ser method. However, I keep getting a
'Cannot create an abstract class' when I try to run my app.

Imports Microsoft.Visua lBasic

Namespace AdamSmithColleg e.Web

Public MustInherit Class CustomSiteMapPr ovider
Inherits SiteMapProvider

Public Overrides Function IsAccessibleToU ser(ByVal context As
HttpContext, ByVal node As SiteMapNode) As Boolean
If node Is Nothing Then
Throw New ArgumentNullExc eption("node")
End If

If context Is Nothing Then
Throw New ArgumentNullExc eption("context ")
End If

If Not Me.SecurityTrim mingEnabled Then
Return True
End If

If (Not node.Roles Is Nothing) And (node.Roles.Cou nt > 0) Then
Dim role As String
For Each role In node.Roles
If Not String.Equals(r ole, "*",
StringCompariso n.InvariantCult ureIgnoreCase) Then
Continue For
End If

Return True
Next
End If

Return False
End Function
End Class
End Namespace

<siteMap defaultProvider ="CustomSiteMap Provider" enabled="true">
<providers>
<add name="XmlSiteMa pProvider"
<add name="CustomSit eMapProvider"
description="Th is provider overrides the IsAccessibleToU ser method."
type="ASC.Web.C ustomSiteMapPro vider"
securityTrimmin gEnabled="true"
siteMapFile="We b.sitemap" />
</providers>
</siteMap>

"Brock Allen" wrote:
You're going to have to create a custom SiteMapProvider and override the
IsAccessibleToU ser method to provide your custom display logic. The easiest
way would be to derive from the existing XmlSiteMapProvi der. Fredrik has
some related sample code:

http://fredrik.nsquared2.com/viewpos...wfeedback=true

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have a master page which contains a Menu control and a SiteMapPath
control, both are bound to the same web.sitemap XML file. Say I have 2
pages, Page 1 and Page 2. Now Page 2 can only be accessed after
selecting some information on Page 1 (using a CrossPagePostba ck). When
the user get's to Page 2, the SiteMapPath control fails to render,
obviously because Page 2 isn't in the web.sitemap file.

If I put Page 2 in the web.sitemap file, it then get's rendered in the
Menu control, which I don't want. So, is there any way to "hide"
certain nodes in a web.sitemap file from the Menu control?

Or is there anyway I can have the SiteMapPath control render properly
on Page 2 whilst not showing it in the Menu control to the user?


Nov 19 '05 #3
You've marked your class as "MustInheri t" which means you can't create an
instance of it. To use the functionality a further dervived class is necessary.
I suspect you didn't intend this. Just remove the keyword.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks for the link.

OK, I've tried to create a class inheriting the StaticSiteMapPr ovider
but only overriding the IsAccessibleToU ser method. However, I keep
getting a 'Cannot create an abstract class' when I try to run my app.

Imports Microsoft.Visua lBasic

Namespace AdamSmithColleg e.Web

Public MustInherit Class CustomSiteMapPr ovider
Inherits SiteMapProvider
Public Overrides Function IsAccessibleToU ser(ByVal context As
HttpContext, ByVal node As SiteMapNode) As Boolean
If node Is Nothing Then
Throw New ArgumentNullExc eption("node")
End If
If context Is Nothing Then
Throw New ArgumentNullExc eption("context ")
End If
If Not Me.SecurityTrim mingEnabled Then
Return True
End If
If (Not node.Roles Is Nothing) And (node.Roles.Cou nt > 0)
Then
Dim role As String
For Each role In node.Roles
If Not String.Equals(r ole, "*",
StringCompariso n.InvariantCult ureIgnoreCase) Then
Continue For
End If
Return True
Next
End If
Return False
End Function
End Class
End Namespace
<siteMap defaultProvider ="CustomSiteMap Provider" enabled="true">
<providers>
<add name="XmlSiteMa pProvider"
<add name="CustomSit eMapProvider"
description="Th is provider overrides the IsAccessibleToU ser
method."
type="ASC.Web.C ustomSiteMapPro vider"
securityTrimmin gEnabled="true"
siteMapFile="We b.sitemap" />
</providers>
</siteMap>
"Brock Allen" wrote:
You're going to have to create a custom SiteMapProvider and override
the IsAccessibleToU ser method to provide your custom display logic.
The easiest way would be to derive from the existing
XmlSiteMapProvi der. Fredrik has some related sample code:

http://fredrik.nsquared2.com/viewpos...howfeedback=tr
ue

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have a master page which contains a Menu control and a SiteMapPath
control, both are bound to the same web.sitemap XML file. Say I have
2 pages, Page 1 and Page 2. Now Page 2 can only be accessed after
selecting some information on Page 1 (using a CrossPagePostba ck).
When the user get's to Page 2, the SiteMapPath control fails to
render, obviously because Page 2 isn't in the web.sitemap file.

If I put Page 2 in the web.sitemap file, it then get's rendered in
the Menu control, which I don't want. So, is there any way to "hide"
certain nodes in a web.sitemap file from the Menu control?

Or is there anyway I can have the SiteMapPath control render
properly on Page 2 whilst not showing it in the Menu control to the
user?


Nov 19 '05 #4
Hi Brock,

Ooops, never saw that in there!

When I remove the 'MustInherit', I am then told that I must override;

FindSiteMapNode
GetChildNodes
GetParentNode
GetRootNodeCore

I then tried to inherit the XmlSiteMapProvi der as this allowed me to only
override the IsAccessibleToU ser, but it didn't seem to work as expected.

In the meantime, I've cheated by having 2 sitemaps, 1 for the menu and one
for the SiteMap Control (breadcrumbs).

"Brock Allen" wrote:
You've marked your class as "MustInheri t" which means you can't create an
instance of it. To use the functionality a further dervived class is necessary.
I suspect you didn't intend this. Just remove the keyword.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks for the link.

OK, I've tried to create a class inheriting the StaticSiteMapPr ovider
but only overriding the IsAccessibleToU ser method. However, I keep
getting a 'Cannot create an abstract class' when I try to run my app.

Imports Microsoft.Visua lBasic

Namespace AdamSmithColleg e.Web

Public MustInherit Class CustomSiteMapPr ovider
Inherits SiteMapProvider
Public Overrides Function IsAccessibleToU ser(ByVal context As
HttpContext, ByVal node As SiteMapNode) As Boolean
If node Is Nothing Then
Throw New ArgumentNullExc eption("node")
End If
If context Is Nothing Then
Throw New ArgumentNullExc eption("context ")
End If
If Not Me.SecurityTrim mingEnabled Then
Return True
End If
If (Not node.Roles Is Nothing) And (node.Roles.Cou nt > 0)
Then
Dim role As String
For Each role In node.Roles
If Not String.Equals(r ole, "*",
StringCompariso n.InvariantCult ureIgnoreCase) Then
Continue For
End If
Return True
Next
End If
Return False
End Function
End Class
End Namespace
<siteMap defaultProvider ="CustomSiteMap Provider" enabled="true">
<providers>
<add name="XmlSiteMa pProvider"
<add name="CustomSit eMapProvider"
description="Th is provider overrides the IsAccessibleToU ser
method."
type="ASC.Web.C ustomSiteMapPro vider"
securityTrimmin gEnabled="true"
siteMapFile="We b.sitemap" />
</providers>
</siteMap>
"Brock Allen" wrote:
You're going to have to create a custom SiteMapProvider and override
the IsAccessibleToU ser method to provide your custom display logic.
The easiest way would be to derive from the existing
XmlSiteMapProvi der. Fredrik has some related sample code:

http://fredrik.nsquared2.com/viewpos...howfeedback=tr
ue

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have a master page which contains a Menu control and a SiteMapPath
control, both are bound to the same web.sitemap XML file. Say I have
2 pages, Page 1 and Page 2. Now Page 2 can only be accessed after
selecting some information on Page 1 (using a CrossPagePostba ck).
When the user get's to Page 2, the SiteMapPath control fails to
render, obviously because Page 2 isn't in the web.sitemap file.

If I put Page 2 in the web.sitemap file, it then get's rendered in
the Menu control, which I don't want. So, is there any way to "hide"
certain nodes in a web.sitemap file from the Menu control?

Or is there anyway I can have the SiteMapPath control render
properly on Page 2 whilst not showing it in the Menu control to the
user?


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3272
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help with this problem. I am uncertain about what etiquette calls for, but more on that later. My Objective: I am trying to control the _VMWare Desktop_ application
6
3233
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect when viewing it in the source code, however, because it doesn't show the complete path to the file. (I'm talking about Internet Explorer click View, click source code.)
7
2692
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote server returned an error: (500) Internal Server Error." I found a post that suggested to catch the WebException to retrieve the actual HttpWebResponse object for more information. The response returned is shown below. At first I thought this was a...
5
2610
by: dpomt | last post by:
When the ASP.NET menu is rendered on downlevel browers, the text "^ up one level" is displayed. Any ideas how I can change that text? I did not find a property for the menu control where I can change it. Dieter
17
2350
by: GS | last post by:
the main menu in the application seemed to disappeared all together until I click on an control and select mainmenu1 in designer. then the mainmenu1 displays where it should be but running it or deselecting the mainmenu1, the menu disappears again. what can I do. to fix the problem
3
2104
by: John | last post by:
Hi there, I was reading an article (http://avenuea-razorfish.com/articles/TheAll-MenuNavigation_Turbek.pdf) on 'all-menu navigation' and I'd like to try and implement this in my site. Can anyone recommend how to get started? Is there an Ajax control available for this or would more a basic javascript work just as well. I'm assuming I just need a div element that is shown on a mouse over, but I'm not sure how to go about aligning all...
5
6176
by: Brad Isaacs | last post by:
Good morning friends, I am working with ASP.NET 2.0 -- VB code behind I have created tabbed pages using the Menu control with the Multiview control. Using the menu control to display the tabs, and the Multiview control to display the content that corresponds to the selected tab. My Menu control needs to be able to switch language from English or French depending on the language chosen by the user.
2
5904
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more commands to the control's context menu? I'm envisioning a case where the control has a set of context menu items, and the parent form also has a set of context menu items. Thanks.
5
1608
by: AG | last post by:
I realize that the obvious suggestion would be malware, but my definitions are up to date and I have already scanned for it. I have also tried disabling all IE add-ons. I just rebuilt and deployed my website (WAP) in ASP.NET 2.0. Everything is working fine except from my development machine with IE6. The master page contains a Menu control bound to a SiteMapDataSource. There is also a row of links (plain links, no menu control) at the...
4
4065
by: SAL | last post by:
Hello, is there a way to menu control dynamically center itself horizontally on a page? I have placed a menu control in a panel control (no ajax) and would like it to center itself. Depending on whose logged in, the menu, or course, displays different items, sometimes just two items, other times many more. If all menu items are displaying, centering is not a problem but when only two items are displayed, the menu appears on the left hand...
0
8652
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9140
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9005
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6511
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3025
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2291
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1987
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.