thedeal56
asked on
Passing Variables Through a URL Generated From a Sitemap.
I have three pages in total. The first page I have accepts user input and sends it to my second page. On the second page, the user's input is used to search a database. From the second page, a user will select the specific record he/she wants to see. That record's info is then passed into my third page. On my third page, I have a sitemap with static URL information (sitemap code is attached). When my third page is first accessed via my second page, the URL info that is passed along looks like this:
third_page.aspx?ctlmap=102 E%20&bill_ group=E%20 &bill_parc el=00500&p ropertyid= %20&specia l=000&dist rict=13
I need the variable information in the above URL to be appended to every static URL in my sitemap. Is there a way to do this? I am using Visual Web Developer with VB. Thanks for reading.
third_page.aspx?ctlmap=102
I need the variable information in the above URL to be appended to every static URL in my sitemap. Is there a way to do this? I am using Visual Web Developer with VB. Thanks for reading.
// Current XML:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="Tax Information" >
<siteMapNode url="~/map/Desc.aspx" title="Property Description" description="Description" />
<siteMapNode url="~/map/Owner.aspx" title="Owner Info" description="Owner" />
</siteMapNode>
</siteMap>
// Goal XML:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="Tax Information" >
<siteMapNode url="~/map/Desc.aspx?ctlmap=102E%20&bill_group=E%20&bill_parcel=00500&propertyid=%20&special=000&district=13" title="Property Description" description="Description" />
<siteMapNode url="~/map/Owner.aspx?ctlmap=102E%20&bill_group=E%20&bill_parcel=00500&propertyid=%20&special=000&district=13" title="Owner Info" description="Owner" />
</siteMapNode>
</siteMap>
while you are traversing to next page you can mention values like
szUrl = "second.aspx?ctlmap=" & txtName.Text + "&bill_group=" & txtGroup.Text ;
Server.Transfer (szUrl)
OR
Response.Redirect(szUrl)
szUrl = "second.aspx?ctlmap=" & txtName.Text + "&bill_group=" & txtGroup.Text ;
Server.Transfer (szUrl)
OR
Response.Redirect(szUrl)
ASKER
Thank you for your fast reply. I like the idea of Server.Transfer(SzUrl, True), but how can I make that apply to the links in my xml file?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I think that's what I'm having trouble understanding. How do I get the url from the xml and work with it in vb?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I found the attached code on this page:
http://msdn.microsoft.com/en-us/library/ms178425(VS.80).aspx
I think I am looking for something like this code. I'm going to work with it and see if I can create what I need. I thought I should post it just to document my steps.
http://msdn.microsoft.com/en-us/library/ms178425(VS.80).aspx
I think I am looking for something like this code. I'm going to work with it and see if I can create what I need. I thought I should post it just to document my steps.
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' The ExpandForumPaths method is called to handle
' the SiteMapResolve event.
AddHandler SiteMap.SiteMapResolve, AddressOf Me.ExpandForumPaths
End Sub
Private Function ExpandForumPaths(ByVal sender As Object, ByVal e As SiteMapResolveEventArgs) As SiteMapNode
' The current node represents a Post page in a bulletin board forum.
' Clone the current node and all of its relevant parents. This
' returns a site map node that a developer can then
' walk, modifying each node.Url property in turn.
' Since the cloned nodes are separate from the underlying
' site navigation structure, the fixups that are made do not
' effect the overall site navigation structure.
Dim currentNode As SiteMapNode = SiteMap.CurrentNode.Clone(True)
Dim tempNode As SiteMapNode = currentNode
' Obtain the recent IDs.
Dim forumGroupID As Integer = GetMostRecentForumGroupID()
Dim forumID As Integer = GetMostRecentForumID(forumGroupID)
Dim postID As Integer = GetMostRecentPostID(forumID)
' The current node, and its parents, can be modified to include
' dynamic querystring information relevant to the currently
' executing request.
If Not (0 = postID) Then
tempNode.Url = tempNode.Url & "?PostID=" & postID.ToString()
End If
tempNode = tempNode.ParentNode
If Not (0 = forumID) And Not (tempNode Is Nothing) Then
tempNode.Url = tempNode.Url & "?ForumID=" & forumID.ToString()
End If
tempNode = tempNode.ParentNode
If Not (0 = ForumGroupID) And Not (tempNode Is Nothing) Then
tempNode.Url = tempNode.Url & "?ForumGroupID=" & forumGroupID.ToString()
End If
Return currentNode
End Function
<br /><span space="preserve">...</span><br /> ' These methods are just placeholders for the example.
' One option is to use the HttpContext or e.Content object
' to obtain the ID.
Private Function GetMostRecentForumGroupID() As Integer
Return 24
End Function
Private Function GetMostRecentForumID(ByVal forumGroupId As Integer) As Integer
Return 128
End Function
Private Function GetMostRecentPostID(ByVal forumId As Integer) As Integer
Return 317424
End Function
ASKER
I'm attaching what I ended up going with.
VB.NET:
Protected Sub Tree_TreeNodeDataBound(ByVal sender As Object, ByVal e As TreeNodeEventArgs)
Dim append As String
append = "?ctlmap=" & Request.QueryString("ctlmap") & "&bill_group=" & Request.QueryString("bill_group") & "&bill_parcel=" & Request.QueryString("bill_parcel") & "&propertyid=" & Request.QueryString("propertyid") & "&special=" & Request.QueryString("special") & "&district=" & Request.QueryString("district")
If e.Node.NavigateUrl = "http://cms.murfreesborotn.gov/PropTax/NewStyle/Start.aspx" Then
e.Node.NavigateUrl += append
End If
If e.Node.NavigateUrl = "http://cms.murfreesborotn.gov/PropTax/NewStyle/Owner.aspx" Then
e.Node.NavigateUrl += append
End If
If e.Node.NavigateUrl = "http://cms.murfreesborotn.gov/PropTax/NewStyle/Amount.aspx" Then
e.Node.NavigateUrl += append
End If
If e.Node.NavigateUrl = "http://cms.murfreesborotn.gov/PropTax/NewStyle/Appraised.aspx" Then
e.Node.NavigateUrl += append
End If
If e.Node.NavigateUrl = "http://cms.murfreesborotn.gov/PropTax/NewStyle/Assessed.aspx" Then
e.Node.NavigateUrl += append
End If
If e.Node.NavigateUrl = "http://cms.murfreesborotn.gov/PropTax/NewStyle/tax/lookup.aspx" Then
e.Node.NavigateUrl += append
End If
End Sub
ASP .NET:
<asp:TreeView runat="server" ID="Tree" DataSourceID="SiteMapDataSource1" ontreenodedatabound="Tree_TreeNodeDataBound"></asp:TreeView>
Sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="Property Tax Information" >
<siteMapNode url="http://cms.murfreesborotn.gov/PropTax/NewStyle/Owner.aspx" title="Owner Info" description="Owner" />
<siteMapNode url="http://cms.murfreesborotn.gov/PropTax/NewStyle/Amount.aspx" title="Totals Due and Amounts Paid" description="Totals Due and Amounts Paid" />
<siteMapNode url="http://cms.murfreesborotn.gov/PropTax/NewStyle/Appraised.aspx" title="Appraised Value" description="Appraised Value" />
<siteMapNode url="http://cms.murfreesborotn.gov/PropTax/NewStyle/Assessed.aspx" title="Assessed Value" description="Assessed Value" />
<siteMapNode url="http://cms.murfreesborotn.gov/PropTax/NewStyle/tax/lookup.aspx" title="Print All" description="Show All" />
</siteMapNode>
</siteMap>
ASKER
I'm not sure how to do the points on this one. I'll wait and here what you guys say about it.
ASKER