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

Ask A Question

Stats

  • Questions 220k
  • Answers 220k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The function getchar() or some other like fgetc, fgets recieve… May 12, 2026 at 11:58 pm
  • Editorial Team
    Editorial Team added an answer To get around the issue of importing 3.4 key bindings… May 12, 2026 at 11:58 pm
  • Editorial Team
    Editorial Team added an answer Apple will silently drop your connection if it receives an… May 12, 2026 at 11:58 pm

Related Questions

By adding a custom handler to the SiteMapResolve event, I can update sitemap url's
I have an ASP.NET GridView which has columns that look like this: | Foo
I wrote a custom validation handler for this ASP.NET MVC application. Here is a
I am using urllib2 to post data to a form. The problem is that
I've implemented a class that looks like this interface: [ImmutableObject(true)] public interface ICustomEvent {

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.