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.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
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:
<dx:ASPxSiteMapDataSource ID="menuSiteMapDataSource" runat="server" SiteMapProvider="MenuSiteMapProvider" />
<dx:ASPxMenu ID="ASPxMenu1" runat="server" DataSourceID="menuSiteMapDataSource" EnableViewState="false">
<SubMenuTemplate>
<dx:ASPxSiteMapControl EnableViewState="False" ID="ASPxSiteMapControl1" runat="server"
DataSource=<%#GetDataSource()%> OnDataBinding="ASPxSiteMapControl1_DataBinding">
<Columns>
<dx:SiteMapColumn />
<dx:SiteMapColumn />
</Columns>
</dx:ASPxSiteMapControl>
</SubMenuTemplate>
</dx:ASPxMenu>
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;
}