Hi there,

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 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 :D

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.


<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="" >
<siteMapNode url="default.aspx" title="Homepage"  description="Home">
    <siteMapNode url="secondpage.aspx" title="Page 2" />


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""&gt;

<html xmlns=""&gt;
<head runat="server">
    <form id="form1" runat="server">
        <asp:Menu runat=server ID=menu DataSourceid=dsSiteMap />
        <asp:SiteMapDataSource ID="dsSiteMap" runat="server" />
        <asp:Label runat=server id=lbMenuCount />


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


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!

Tabloo Quijico
yes, you are absolutlty right, I have checked your example and found the same......... Good LUCK :)
Muhammad Akhtar