Add Querystring to Sitemap that is in master Page

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
cgcmqAsked:
Who is Participating?
 
guru_samiConnect With a Mentor Commented:
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
 
guru_samiCommented:
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
 
cgcmqAuthor Commented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
guru_samiCommented:
you do that in masterpage code-behind and not in childpage.
0
 
cgcmqAuthor Commented:
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
 
guru_samiCommented:
-->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
 
cgcmqAuthor Commented:
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
 
guru_samiCommented:
Then you simply access that in master page normally as you would do in childpage:
Request.QueryString["name"]
0
 
guru_samiCommented:
oops ..VB :
Request.QueryString("name")
0
 
cgcmqAuthor Commented:
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
 
guru_samiCommented:
and did it point to this line: Dim s As String = e.Item.SiteMapNode.Url ??
0
 
cgcmqAuthor Commented:
Yes it did.
0
 
cgcmqAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.