Customise the SiteMapPath Control or use wild card URLs with a custom SiteMapProvider

Discussion in 'ASP .Net Web Controls' started by Alexander Walker, Jan 21, 2006.

  1. Hello

    I am using a custom site map provider to create a site map populated from a
    database.

    I am using the SiteMapPath control to display "bread crumbs" on the pages of my
    site.

    The database is divided into categories, each category contains items, there are
    thousands of categories and tens of thousands of items. Correct me if I am
    mistaken, but, I think that creating a site map that contains all of the
    categories and all of the items in the database would not be feasible, so I have
    limited the number of categories to the top three levels and excluded all items
    from the site map, the remaining categories are pulled from the database as
    needed.

    The SiteMapPath Control produces output similar to the following line when a
    certain URL is accessed

    Category 1 / Sub Category 2 / Sub Category 3

    The site map path above could be produced by using a URL such as the following

    category.aspx?category=1&subcategory=2&childcategory=3

    Each category page displays a list of items. The user can choose to select an
    item to inspect it's details. The resultant URL would look like this

    detail.aspx?category=1&subcategory=2&childcategory=3&item=1

    At this point the SiteMapPath control does not display anything. I have tried
    adding a dummy item entry to the site map that matches the following URL

    detail.aspx?category=1&subcategory=2&childcategory=3

    But this makes no difference. I was thinking of creating a customised
    SiteMapPath Control that removed the "item" portion of the query string from the
    URL so that it is treated like the dummy item that was set up in the site map,
    but I can't figure out where to start, what method or property to override. Is
    it possible to extend the behaviour of the SiteMapPath so that it will recognise
    URLs that match only part a URL contained in the site map?

    What can I do to cause the SiteMapPath control to display bread crumbs in a
    situation where the actual URL does not exist in the sitemap, the URL I want to
    match with is similar to URLs that are in the site map, are there any wild cards
    that can be used when specifying the URL of sitemap entries?

    Thanks

    Alex
    Alexander Walker, Jan 21, 2006
    #1
    1. Advertising

  2. Hi Alex,

    As for the SiteMapPath control, it will call the SiteMapProvider's method
    to determine the current Node and path... e.g, the CurrentNode property
    and the GetCurrentNodeAndHintAncestorNodes method... so how are you
    currently doing in the custom sitemapprovider? From teh MSDN documenation,
    it describe the "CurrentNode" property and the
    GetCurrentNodeAndHintAncestorNodes method wihch can be overrided to provide
    custom path resolving rules....

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | From: "Alexander Walker" <>
    | Subject: Customise the SiteMapPath Control or use wild card URLs with a
    custom SiteMapProvider
    | Date: Sat, 21 Jan 2006 03:03:00 -0000
    | Lines: 52
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
    | Message-ID: <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
    | NNTP-Posting-Host: 81-6-217-221.gotadsl.co.uk 81.6.217.221
    | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
    | Xref: TK2MSFTNGXA02.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webcontrols:32703
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
    |
    | Hello
    |
    | I am using a custom site map provider to create a site map populated from
    a
    | database.
    |
    | I am using the SiteMapPath control to display "bread crumbs" on the
    pages of my
    | site.
    |
    | The database is divided into categories, each category contains items,
    there are
    | thousands of categories and tens of thousands of items. Correct me if I
    am
    | mistaken, but, I think that creating a site map that contains all of the
    | categories and all of the items in the database would not be feasible, so
    I have
    | limited the number of categories to the top three levels and excluded all
    items
    | from the site map, the remaining categories are pulled from the database
    as
    | needed.
    |
    | The SiteMapPath Control produces output similar to the following line
    when a
    | certain URL is accessed
    |
    | Category 1 / Sub Category 2 / Sub Category 3
    |
    | The site map path above could be produced by using a URL such as the
    following
    |
    | category.aspx?category=1&subcategory=2&childcategory=3
    |
    | Each category page displays a list of items. The user can choose to
    select an
    | item to inspect it's details. The resultant URL would look like this
    |
    | detail.aspx?category=1&subcategory=2&childcategory=3&item=1
    |
    | At this point the SiteMapPath control does not display anything. I have
    tried
    | adding a dummy item entry to the site map that matches the following URL
    |
    | detail.aspx?category=1&subcategory=2&childcategory=3
    |
    | But this makes no difference. I was thinking of creating a customised
    | SiteMapPath Control that removed the "item" portion of the query string
    from the
    | URL so that it is treated like the dummy item that was set up in the site
    map,
    | but I can't figure out where to start, what method or property to
    override. Is
    | it possible to extend the behaviour of the SiteMapPath so that it will
    recognise
    | URLs that match only part a URL contained in the site map?
    |
    | What can I do to cause the SiteMapPath control to display bread crumbs in
    a
    | situation where the actual URL does not exist in the sitemap, the URL I
    want to
    | match with is similar to URLs that are in the site map, are there any
    wild cards
    | that can be used when specifying the URL of sitemap entries?
    |
    | Thanks
    |
    | Alex
    |
    |
    |
    Steven Cheng[MSFT], Jan 23, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    2,566
    tom fredriksen
    Mar 14, 2006
  2. John

    Wild card symbol in name?

    John, Feb 28, 2006, in forum: HTML
    Replies:
    5
    Views:
    641
  3. glen_davie
    Replies:
    0
    Views:
    394
    glen_davie
    Jul 26, 2007
  4. W. eWatson

    Wild Card String Comparison

    W. eWatson, Aug 28, 2008, in forum: Python
    Replies:
    6
    Views:
    454
    W. eWatson
    Aug 28, 2008
  5. Replies:
    1
    Views:
    107
    BettyB
    Dec 28, 2005
Loading...

Share This Page