SiteMap questions

D

Dave H

I have to questions about SiteMaps

1st) Is there any way to use a wildcard in the SiteMapNode?

I'd like:
testpage.aspx?Type=Fruit&SubType=Apple
and
testpage.aspx?Type=Fruit&SubType=Orange

to show resolve the same. The subtype has many possibilities and is passed
from the previous page.

2nd)

Are there any examples out there about how to manipulate the SiteMap in ASP?
I can't even seem to find the control. I am using a MasterPage containing
the SiteMap, and I'm trying to reference it from the 'child' page (OnLoad).

Thanks in advance.. Dave
 
C

clintonG

I might be able to help with part of what you asked about if you explain
what you mean when you say you can't even seem to find the control?

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W
 
D

Dave H

Thanks..

In the IDE.. when I'm editing the MasterPage.. I can get the ME.SiteMap1
listed when I type "ME.", but in the child page, I'm not sure how to
reference it.

I tried
oParent.FindControl('...')
Master.
Me.

None of these seem to show it..
 
W

Walter Wang [MSFT]

Hi Dave,

I'm not sure I fully understand your first question, would you please
elaborate more on it?

For the second question, if you mean to access navigation structure, you
can use the SiteMap static class to access the data such as RootNode,
CurrentNode, etc.

If you mean to find a control on the master page from your content page,
you can use following function to find it:

private Control FindControlRecursive(Control root, string id)
{
if (root.ID == id)
{
return root;
}

foreach (Control c in root.Controls)
{
Control t = FindControlRecursive(c, id);
if (t != null)
{
return t;
}
}

return null;
}

Then you can use:

SiteMapPath SiteMapPath1 = (SiteMapPath)FindControlRecursive(this,
"SiteMapPath1");

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
K

Kevin Jones

I'd like:
> testpage.aspx?Type=Fruit&SubType=Apple
> and
> testpage.aspx?Type=Fruit&SubType=Orange


Take a look at the URL mapping section it might let you do what you
want. You can have a sitemap like this

<siteMapNode url="testpage1.aspx" .../>
<siteMapNode url="testpage2.aspx" .../>

and in the web.config have

<urlMappings>
<add url="~/testpage1.aspx"
mappedUrl=testpage.aspx?Type=Fruit&SubType=Apple"/>
<add url="~/testpage2.aspx"
mappedUrl=testpage.aspx?Type=Fruit&SubType=Orange"/>
> 2nd)
>
> Are there any examples out there about how to manipulate the SiteMap in ASP?
> I can't even seem to find the control. I am using a MasterPage containing
> the SiteMap, and I'm trying to reference it from the 'child' page
(OnLoad).

Depends what you are trying to do, you should be able to call
SiteMap.CurrentNode to get the current node and work from there,

Kevin Jones
 
C

clintonG

To reference controls -- in content pages -- when using a MasterPage we can
use public properties or the FindControl method. Public properties are early
bound and using FindControl is late bound. Turn on trace in the content page
that contains the control you want to reference. Read the control tree
hierarchy of the content page and submit each part of the hierarchy as an
argument to the FindControl method.

The 2.0 controls are templated and will nest your use of standard controls
deeply at times as the following example shows noting this example is quite
shallow compared to how deep it can get depending on which templated
controls you are using ...

LinkButton channelEditor =
(LinkButton)(Master.FindControl("CenterPanelContent").FindControl("ChannelEditor"));


<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W
 
W

Walter Wang [MSFT]

Thanks Clinton. That's right, in addition to use FindControl (and
recursively find the control you wanted), we can use the Master property of
content page's Page class to reference to the master page. However, this
reference is of type MasterPage rather than the inherited class generated
from the master page. To get a strong typed Master reference:

In the content page's ASPX source, add an @ MasterType directive so that
we can use a strongly typed Master reference:

<%@ MasterType VirtualPath="~/MasterPage.master" %>



Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,217
Latest member
topweb3twitterchannels

Latest Threads

Top