473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Programmatically Modify Site-Map Nodes in Memory

First look at: http://msdn2.microsoft.com/en-us/lib...25(VS.80).aspx

I've tried this, and while the code sort of works, the modified SiteMapNodes
get stuck in memory and can't be modified on other requests without having to
kill the aspnet_wp manually.

ISSUE: I need to modify the URL and TITLE of the last link on the
SiteMapPath (breadcrumb) control. I have a parent page called "companies"
that displays a list of results. Clicking on a company should take you to
the "details" page passing along the ID on the querystring. Now, when you
get to the details page I need to append that ID on to the current node and
change the title to the name of the company.

Take a sample from the sitemap:

<siteMapNode url="Companies/default.aspx" title="Companies"
description="Companies">
<siteMapNode url="Companies/manage.aspx" title="Manage"
description="Manage"></siteMapNode>
<siteMapNode url="Companies/view.aspx" title="View"
description="View"></siteMapNode>
</siteMapNode>
When viewing the list the SiteMapPath renders correctly as:
Home / Companies

When I follow the MS example and when the user is on the details page the
control renders as:
Home / Companies / Company ABC [/Companies/view.aspx?id=123]

All looks good. But, when you go back to the list and select a different
company you end up with the same rendering even through the URL in the
broswer has the ID of the new company.

Home / Companies / Company ABC [/Companies/view.aspx?id=123]

should be

Home / Companies / Company XYZ [/Companies/view.aspx?id=789]

The only way I get the SiteMapPath to refresh correctly is to manually kill
the aspnet_wp and refresh the page. But then it's stuck on Company XYZ.

Also, if I make a change to the SiteMap file, changes are reflected until I
kill the aspnet_wp.

Environment: XP SP2 & VS.NET '05
Mar 17 '06 #1
1 5078
<asp:SiteMapPath ID="ctrlBreadCrumbs" runat="server" EnableViewState="false"
PathSeparator="/" SkipLinkText="Skip Navigation"
RenderCurrentNodeAsLink="true"></asp:SiteMapPath>

public partial class Controls_Layout : System.Web.UI.MasterPage
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);

SiteMap.SiteMapResolve += new
SiteMapResolveEventHandler(this.ModifyBreadCrumbs) ;
}

private SiteMapNode ModifyBreadCrumbs(Object sender,
SiteMapResolveEventArgs e)
{
SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
SiteMapNode tempNode = currentNode;

if (Context.Request.QueryString["id"] != null)
{
IOrganization org = this._objFactory.Organizations.Get(new
Guid(Context.Request.QueryString["id"].ToString()));

tempNode.Url = string.Format("{0}?{1}", tempNode.Url,
Context.Request.QueryString);
tempNode.Title = org.DisplayName;
}

return currentNode;
}
}
Mar 17 '06 #2

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

Similar topics

0
by: Keith | last post by:
Is it possible to modify the file properties of a file programmatically? For example, every file, when you right click has a properties option, then from that you can select the summary tab and...
3
by: R Reyes | last post by:
Just wondering if anyone knows the pros/cons between creating a database programmatically vs using the application's tool windows/features that come with SQLServer, Access, Oracle, etc... Is it...
0
by: Kevin | last post by:
I am successfully creating and deleting appointments and sending invitations in a C# / ASP.NET / Exchange2000 environment. It works great! But the problem is that no notifications are sent out...
0
by: Promenade | last post by:
Hi, everyone: I want to modify the value of the SessionState. I also need to do it programmatically (not by modifying the web.config file). My first option was alter the value of the Mode...
2
by: TK | last post by:
What's the best way to edit web.config programmatically? I want to have an aspx page as a GUI for web admins to modify the roll-base security portion of the web.config(s) on a server. please...
1
by: Leo Muller | last post by:
I am impressed by the caching performance of .NET. However, there is one major obstacle that I haven't managed to solve yet. What I want to do is the following: I have a normal site, and a...
3
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change...
1
by: Superfreak3 | last post by:
We have a web application that will be installed as a virtual directory. It will either default to the Default Web Site or allow the choice of the site to which the vir. dir. will be installed, if...
2
by: Orit | last post by:
Hello . Please find below my questions - I hope some of the ASP.NET experts of this forum will answer to those beginner's questions : My Web site should be able to work with either SQL Server...
6
by: Andrew Jocelyn | last post by:
Hi How do I programmatically change (read/write) the values in this app.config file at runtime? Specifically I want to change the client endpoint address but it would be nice to change other...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.