The original Published time: 2008-07-29--from my Baidu article [imported by moving tools]
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
Public partial class Sitemap:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
sitemap.sitemapresolve+=new Sitemapresolveeventhandler (Sitemap_sitemapresolve);
}
SiteMapNode sitemap_sitemapresolve (Object Sender,sitemapresolveeventargs e)
{
SiteMapNode CurrentNode = SiteMap.CurrentNode.Clone (true);
SiteMapNode Tempnode=currentnode;
int Id=nid ();
int page=npage ();
if (Id > 0)
{
Tempnode.url = Tempnode.url + "? id=" + ID. ToString ();
}
if (Id > 0 && page >= 0)
{
tempnode.url = Tempnode.url + "&page=" + page. ToString ();
}
Else if (page >= 0)
{
Tempnode.url = Tempnode.url + "? page=" + page . ToString ();
}
return tempnode;
}
private int nid ()
{
return 2;
}
private int Npage ()
{
return 3;
}
}
NET5: Dynamically modifying a site map node in memory