Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 261805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:27:45+00:00 2026-05-11T22:27:45+00:00

By adding a custom handler to the SiteMapResolve event, I can update sitemap url’s

  • 0

By adding a custom handler to the SiteMapResolve event, I can update sitemap url’s on the fly, by some logic that I define.

This is ok for SiteMapPath controls, that appear to use this SiteMapResolve functionality… however I want to achieve a similar result for an asp.net Menu control that uses a SiteMapDataSource. Altering nodes with the SiteMapResolve handler doesn’t have any effect.

Could anyone point me in the right direction?
cheers 😀

edit:sourcecode
I’ve removed everything unnecessary and am left with the following – I must be misunderstanding something to do with the structure of the menuItemCollecton but it’s always empty.

web.sitemap


<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="default.aspx" title="Homepage"  description="Home">
    <siteMapNode url="secondpage.aspx" title="Page 2" />
</siteMapNode>
</siteMap>

default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Menu runat=server ID=menu DataSourceid=dsSiteMap />
        <asp:SiteMapDataSource ID="dsSiteMap" runat="server" />
        <asp:Label runat=server id=lbMenuCount />
    </div>
    </form>
</body>
</html>

default.aspx.vb


Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lbMenuCount.text = menu.Items.Count End Sub End Class

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:27:46+00:00Added an answer on May 11, 2026 at 10:27 pm

    Thank you for your pointers Muhammad, but I think I’ve cracked the problem.

    I guess the menuItemCollection only looks at statically-defined items (i.e. within the code of the menu) wheras I’m linking to an XML datasource – so Muhammad’s solution doesn’t work

    I have solved the problem by placing my code into the menu_MenuItemDataBound event – and am getting the results I want.

    Thanks for all the help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JUnit test that tests adding Strings to a Dictionary custom type.
I'm wondering how one can catch and add a custom handler when empty results
Hopefully there are some WCF wizards out there that can spot my mistake here.
I am adding custom controls to a FlowLayoutPanel. Each control has a date property.
ActionScript 3 / Flex 3 - Adding custom events to a class Say I
I'm in the process of adding custom buttons to my iPhone UI and want
I am adding a custom background for my UINavigationBar. It works fine as long
I am adding a custom background image to my navigation bar by creating an
I'm dynamically adding a custom user control to the page as per this post
I'm using a TableAdapter for the first time and adding a custom query to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.