Skip to main content
A newer version of this page is available. .
Tab

ASPxSiteMapDataSource.StartingNodeUrl Property

Gets or sets a node in the site map that the data source then uses as a reference point to retrieve nodes from a hierarchical site map.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public override string StartingNodeUrl { get; set; }

Property Value

Type Description
String

The URL of a node in the site map. The ASPxSiteMapDataSource retrieves the identified SiteMapNode and any child nodes from the site map.

Remarks

If the ASPxSiteMapDataSource.ShowStartingNode property is set to true, the StartingNodeUrl property can be used to specify the URL of the starting node which is the root node of the site map hierarchy.

Note that this property is not in effect if the ASPxSiteMapDataSource.ShowStartingNode property is set to false.

Example

This example illustrates how to share the same SiteMap between ASPxMenu and ASPxSiteMapControl placed to show information from different SiteMap node levels. Here are steps you need to execute:- Place ASPxSiteMapControl within SubMenuTemplate;

- Specify the ASPxSiteMapControl.DataSource property. ASPxSiteMapControl and ASPxMenu should have different ASPxSiteMapDataSource;

- Handle the ASPxSiteMapControl.DataBinding event;

- Define the StartingNodeUrl property according to the parent menu node's NavigateUrl:

View Example

// Developer Express Code Central Example:
// How to share the same SiteMap between ASPxMenu and ASPxSiteMapControl placed within ASPxMenu.SubMenuTemplate
// 
// This example illustrates how to share the same SiteMap between ASPxMenu and
// ASPxSiteMapControl placed to show information from different SiteMap node
// levels. Here are steps you need to execute:
// - Place ASPxSiteMapControl within the ASPxMenu.SubMenuTemplate;
// - Specify the ASPxSiteMapControl.DataSource property. ASPxSiteMapControl and
// ASPxMenu should have different ASPxSiteMapDataSource;
// - Handle the ASPxSiteMapControl.DataBinding event;
// - Define the ASPxSiteMapDataSource.StartingNodeUrl property according to the parent 
// menu node's NavigateUrl:
// 
// You can find sample updates and versions for different programming languages here:
// https://supportcenter.devexpress.com/ticket/details/e3622/how-to-share-sitemap-between-menu-and-sitemapcontrol-placed-within-submenutemplate

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DevExpress.Web.ASPxMenu;
using DevExpress.Web.ASPxSiteMapControl;


public partial class _Default : System.Web.UI.Page {
    protected void Page_Load (object sender, EventArgs e) {

    }
    public object GetDataSource() {
        ASPxSiteMapDataSource ds = new ASPxSiteMapDataSource();
        ds.SiteMapProvider = menuSiteMapDataSource.SiteMapProvider;
        return ds;
    }
    protected void ASPxSiteMapControl1_DataBinding(object sender, EventArgs e) {
        ASPxSiteMapControl sitemapControl = sender as ASPxSiteMapControl;
        DevExpress.Web.ASPxMenu.MenuItemTemplateContainer container = sitemapControl.NamingContainer as DevExpress.Web.ASPxMenu.MenuItemTemplateContainer;
        (sitemapControl.DataSource as ASPxSiteMapDataSource).StartingNodeUrl = container.Item.NavigateUrl;
    }
}
See Also