Solved

Add Querystring to Sitemap that is in master Page

Posted on 2010-09-17
13
1,117 Views
Last Modified: 2013-11-27
I have a SiteMapPath in a Master Page:
<asp:SiteMapPath ID="SiteMapPath1" runat="server" PathSeparator=" &#187; " />
(i.e breadcrumb).

On one of my pages I need to append a querystring to the URL of the node immediately before the current node.  Any idea how I can do this.

Code behind is VB
0
Comment
Question by:cgcmq
  • 7
  • 6
13 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 33703070
haven't tried but see if you can manipulate item in ItemDataBound event like:

Protected Sub SiteMapPath1_ItemDataBound(sender As Object, e As SiteMapNodeItemEventArgs) Handles SiteMapPath1.ItemDataBound
      Dim s As String = e.Item.SiteMapNode.Url
End Sub
0
 

Author Comment

by:cgcmq
ID: 33703176
As the SiteMapPath is in the Master Page, SiteMaPath1 is not recognized (not declared) in the child page where I need to append the querystring.

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33703223
you do that in masterpage code-behind and not in childpage.
0
 

Author Comment

by:cgcmq
ID: 33703250
If I try to manipulate the URL of the SiteMap node in the master page, I would have to somehow pass the query string that is in the child page to the Master Page.  How would I do that?
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33703281
-->I would have to somehow pass the query string that is in the child page to the Master Page.
Did not get that part.
Do you mean the querystring from browser url?
0
 

Author Comment

by:cgcmq
ID: 33703398
The child page receives a query string:  childpage.aspx?name=bob

I need to append the query string to the URL of one of the nodes in the breadcrumb.  The problem is that the breadcrumb is in a master page.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 41

Expert Comment

by:guru_sami
ID: 33703449
Then you simply access that in master page normally as you would do in childpage:
Request.QueryString["name"]
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33703459
oops ..VB :
Request.QueryString("name")
0
 

Author Comment

by:cgcmq
ID: 33703738
Okay.

I tried the following in the master page:

    Protected Sub SiteMapPath1_ItemDataBound(ByVal sender As Object, ByVal e As SiteMapNodeItemEventArgs) Handles SiteMapPath1.ItemDataBound
       Dim s As String = e.Item.SiteMapNode.Url
    End Sub

Unfortunately it returned an error: Object reference not set to an instance of an object.

0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33703767
and did it point to this line: Dim s As String = e.Item.SiteMapNode.Url ??
0
 

Author Comment

by:cgcmq
ID: 33703822
Yes it did.
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 33704019
Ok I tried a and see why you get that error, but I got another error because, Sitemap.Url is read-only.
So unfortunately, the way I proposed won't work, or might need more-time to make it work.

However, here I found this blog post which uses custom sitemapprovider to do this. Check it out and see if you can integrate it in your app:
http://weblogs.asp.net/jgaylord/archive/2008/06/04/adding-querystring-parameters-to-the-sitemapnode.aspx
0
 

Author Comment

by:cgcmq
ID: 33704323
Thanks for all the help.  I too am surprised that there is no built-in way of doing it.  I will see what luck I have following the instructions in the link.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Allow space in this pattern 2 46
Server Error 11 47
How would you add MULTITHREADING to the attached C# code? 4 49
How to add <appSettings> to the webconfig file 2 20
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now