Note that there are some explanatory texts on larger screens.

plurals
  1. POEquivalent effect of custom SiteMapResolve for SiteMapDataSource
    primarykey
    data
    text
    <p>By adding a custom handler to the SiteMapResolve event, I can update sitemap url's on the fly, by some logic that I define. </p> <p>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.</p> <p>Could anyone point me in the right direction? cheers :D</p> <p>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.</p> <p>web.sitemap<pre><code> <code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;</code> <code>&lt;siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &gt;</code> <code>&lt;siteMapNode url="default.aspx" title="Homepage" description="Home"&gt;</code> <code>&lt;siteMapNode url="secondpage.aspx" title="Page 2" /&gt;</code> <code>&lt;/siteMapNode&gt;</code> <code>&lt;/siteMap&gt;</code> </code></pre></p> <p>default.aspx</p> <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Menu runat=server ID=menu DataSourceid=dsSiteMap /&gt; &lt;asp:SiteMapDataSource ID="dsSiteMap" runat="server" /&gt; &lt;asp:Label runat=server id=lbMenuCount /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>default.aspx.vb <pre><code><br> Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br> lbMenuCount.text = menu.Items.Count End Sub End Class</code></pre></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload