CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 12/24/2005 12:28:08 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 33 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
RichardMathis
Asp.Net User
stubborn SiteMapNode refuses to update12/24/2005 12:28:08 AM

0/0

Hello,

   I am experimenting with the navigation tools, and at this point I'm trying to get the breadcrumb control to update based on the querystring.

I made this function.

Private Function ShowCurrentnode(ByVal sender As Object, ByVal e As SiteMapResolveEventArgs) As SiteMapNode

Dim currentnode As SiteMapNode = SiteMap.CurrentNode.Clone(True)

Dim tempnode As SiteMapNode = currentnode

tempnode.Title = objcategory.Title

Return currentnode

End Function

call this in the pageload event

If Not Page.IsPostBack Then

If Not Request.QueryString("id") Is Nothing Then

objcategory = adaptercontentcats.GetDataByID(Request.QueryString("id"))(0)

End If

End If

AddHandler SiteMap.SiteMapResolve, AddressOf Me.ShowCurrentnode

 

and it works once...  After that, the breadcrumb "sticks" to whatever the first load was, never calling the sitemapresolve event again. 

Can anyone look at my code and tell me what I'm doing wrong?

 

Thank you in advance,


Richard Mathis
Dndorks Webmaster
http://dndorks.com/
TopWebcomics Webmaster
http://topwebcomics.com/
dannychen
Asp.Net User
Re: stubborn SiteMapNode refuses to update12/27/2005 7:26:56 PM

0/0

The SiteMapProvider is global to your entire application, not an instance based on the request.  That means that any SiteMapResolve handlers are applied to every request as soon as they are set up.  The best place for code like this is in Global.asax.  Take a look at the sample in the "Personal WebSite Starter Kit". 
--
Danny


disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
RichardMathis
Asp.Net User
Re: stubborn SiteMapNode refuses to update1/3/2006 5:08:18 PM

0/0

That worked great for me Danny!  I guess I should probably stop looking in what apparantly are outdated MSDN articles and focus more on tearing apart the sample applications. :)

Now I do worry about this sort of scenario because if I want to convert a portion of the querystring  into a new breadcrumb title, then it means another database call (one in the global sitemapresolve event and another in the page).  Is there a better way to pass this sort of information back and forth? 


Richard Mathis
Dndorks Webmaster
http://dndorks.com/
TopWebcomics Webmaster
http://topwebcomics.com/
dannychen
Asp.Net User
Re: stubborn SiteMapNode refuses to update1/3/2006 6:25:23 PM

0/0

Richard,
  It sounds like you have a url that is:  mypage.aspx?a=b&c=d and, a title "my page", and you would like, for example, to have the title say:  "my page: b"  where b comes from the query string.  Currently you are using a DB access to requery the value for b?  In thise case, I think you could use templating kind of like this...

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<
script runat="server">
    Private Function Filter(ByVal title As String, ByVal url As String) As String
        Return "T:" & title & "U:" & url
    
End Function
</
script>

<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
    <title>Untitled Page</title>
</
head>
<
body>
    <form id="form1" runat="server">
    <div>
        <asp:SiteMapPath ID="SiteMapPath1" runat="server" >
        <CurrentNodeTemplate>
            <asp:Label runat="server" ID="Label1" Text='<%# Filter( Eval("title"), Eval("url")) %>' />
        </CurrentNodeTemplate>
        </asp:SiteMapPath>
    
    
</div>
    </form>
</
body>
</
html>


If I'm totally wrong, let me know and I'll try and come up with an answer that is more for what you're doing.
--
Danny

disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
RichardMathis
Asp.Net User
Re: stubborn SiteMapNode refuses to update1/3/2006 7:59:34 PM

0/0

Thats exactly what I'm doing, I didn't know I could template the sitemappath like that, thats awesome.  Too many new things in asp.net 2.0 not enough spare learning time to thoroughly go through each one. :)


Richard Mathis
Dndorks Webmaster
http://dndorks.com/
TopWebcomics Webmaster
http://topwebcomics.com/
RichardMathis
Asp.Net User
Re: stubborn SiteMapNode refuses to update1/5/2006 9:28:26 PM

0/0

Ok, Hopefully last thing and not sure if its possible in an efficient manner.

I'm using URL Rewriting to convert /content/4.aspx into

/content.aspx?id=4

Using the sitenode template I can pull my content object from my database just once and assign the proper title for that ID along with all the formatting and content with just 1 database pull.  This creates something like: Home > Caesars Palace Hotel and Casino

Is it possible to create a dynamic site hierarchy with just 1 database pull?  In other words, I'd like it to look like: Home > Las VegasCaesars Palace Hotel and Casino

 Now I can see how to add nodes in the global.asax (which would require a second database pull), or I could just alter my function to output a link going to the content category plus the ">" plus the content title, but basically I'm asking if there is a best practices way of doing this I should be aware of.
Richard Mathis
Dndorks Webmaster
http://dndorks.com/
TopWebcomics Webmaster
http://topwebcomics.com/
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
stubborn SiteMapNode refuses to update - ASP.NET Forums Re: stubborn SiteMapNode refuses to update. 12-27-2005, 2:26 PM ... Re: stubborn SiteMapNode refuses to update. 01-03-2006, 12:08 PM ...
Community MX Web Service Example 1 The latest update, the ColdFusion MX 6.1 updater (code named Red Sky) was ...... Recently, one of our subscribers made me an offer I couldn't refuse. ...
stubborn SiteMapNode refuses to update - ASP.NET Forums Re: stubborn SiteMapNode refuses to update. 12-27-2005, 2:26 PM ... Re: stubborn SiteMapNode refuses to update. 01-03-2006, 12:08 PM ...
Community MX Web Service Example 1 The latest update, the ColdFusion MX 6.1 updater (code named Red Sky) was ...... Recently, one of our subscribers made me an offer I couldn't refuse. ...
stubborn SiteMapNode refuses to update - ASP.NET Forums Re: stubborn SiteMapNode refuses to update. 12-27-2005, 2:26 PM ... Re: stubborn SiteMapNode refuses to update. 01-03-2006, 12:08 PM ...
Community MX Web Service Example 1 The latest update, the ColdFusion MX 6.1 updater (code named Red Sky) was ...... Recently, one of our subscribers made me an offer I couldn't refuse. ...
stubborn SiteMapNode refuses to update - ASP.NET Forums Re: stubborn SiteMapNode refuses to update. 12-27-2005, 2:26 PM ... Re: stubborn SiteMapNode refuses to update. 01-03-2006, 12:08 PM ...
Community MX Web Service Example 1 The latest update, the ColdFusion MX 6.1 updater (code named Red Sky) was ...... Recently, one of our subscribers made me an offer I couldn't refuse. ...
stubborn SiteMapNode refuses to update - ASP.NET Forums Re: stubborn SiteMapNode refuses to update. 12-27-2005, 2:26 PM ... Re: stubborn SiteMapNode refuses to update. 01-03-2006, 12:08 PM ...
Community MX Web Service Example 1 The latest update, the ColdFusion MX 6.1 updater (code named Red Sky) was ...... Recently, one of our subscribers made me an offer I couldn't refuse. ...




Search This Site:










frame

grid view checkbox question.

enterprise library for net 2.0 january 2006 question

difference between asp.net 1.1 and 2.0?

authentication issues using webdav

search function

page side error trapping

ibuyspy portal with oracle db

sos online waiting solution

issuetracker

suggestion box bug

help with remote debugging

child or tree type links in the links module

show gridview on sharepoint created web part

sendmail

user control ids, css ids

recursive xml read

visual studion 2005 split view

passing values between pages

navigation objects [not impressed]

no question is too simple huh?

ann: telerik.com topmenu and sidepanel enhancement now at snowcovered.

password format specified is invalid

yetanotherforum and dnn integration.

why vb works but c# doesn't for these?

boolean not rendering on ascx

generic collection loop

formatting problem

firefox- solpart hides behind flash & iframes

underground artist portal - 80% done. suggestions?

 
All Times Are GMT