This project is read-only.

Sub Menu

Topics: Developer Forum, User Forum
Apr 20, 2007 at 1:18 PM

Would like to have a treeview or other menu show only pages in current section. Tried using StartingNodeOffset="1" but unfortunately the SiteMapDatasource goes bezerk not showing changes when navigating through site sections. This is due to postbacks with default.aspx and page id. When typing in the browser address bar the proper page name the SiteMapDataSource resolves current nodes and subsections. Any way to force SiteMapDatasource to refresh while having StartingNodeOffset="1"? Note that if one removes StartingNodeOffset="1" then SiteMapDatasource is ok and resolves current pages properly.
Apr 22, 2007 at 11:22 AM
This seems to work right now, last line is most relevant: SitemapDataSource.StartingNodeUrl seems to work.

protected void siteMapPath_ItemDataBound(object sender, SiteMapNodeItemEventArgs e)
string strCurNode;
string strCurURL;
System.Web.UI.WebControls.SiteMapPath instanceTemp = new System.Web.UI.WebControls.SiteMapPath();

strCurNode = instanceTemp.Provider.CurrentNode.ParentNode.ToString();
strCurURL = instanceTemp.Provider.CurrentNode.ParentNode.Url.ToString();

if (strCurNode == "")
strCurNode = instanceTemp.Provider.CurrentNode.ToString();
strCurURL = instanceTemp.Provider.CurrentNode.Url.ToString();
lbtnParentPage.Text = strCurNode.ToUpper();
lbtnParentPage.PostBackUrl = strCurURL;
lblParentPageURL.Text = strCurURL;

//fix menudatasourceStartingNodeOffset="1"
menuDataSource.StartingNodeUrl = lblParentPageURL.Text;