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.v19.2.dll
Declaration
public override string StartingNodeUrl { get; set; }
Public Overrides Property StartingNodeUrl As String
Property Value
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:
// 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:
// http://www.devexpress.com/example=E3622
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;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v13.2, Version=13.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxMenu" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.2, Version=13.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxSiteMapControl" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to share the same SiteMap between ASPxMenu and ASPxSiteMapControl placed within ASPxMenu.SubMenuTemplate</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<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>
</div>
</form>
</body>
</html>
' 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 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:
' http://www.devexpress.com/example=E3622
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports DevExpress.Web.ASPxMenu
Imports DevExpress.Web.ASPxSiteMapControl
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Public Function GetDataSource() As Object
Dim ds As New ASPxSiteMapDataSource()
ds.SiteMapProvider = menuSiteMapDataSource.SiteMapProvider
Return ds
End Function
Protected Sub ASPxSiteMapControl1_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
Dim sitemapControl As ASPxSiteMapControl =
TryCast(sender, ASPxSiteMapControl)
Dim container As DevExpress.Web.ASPxMenu.MenuItemTemplateContainer =
TryCast(sitemapControl.NamingContainer, DevExpress.Web.ASPxMenu.MenuItemTemplateContainer)
TryCast(sitemapControl.DataSource, ASPxSiteMapDataSource).StartingNodeUrl = container.Item.NavigateUrl
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v13.2, Version=13.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxMenu" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.2, Version=13.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxSiteMapControl" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>How to share the same SiteMap between ASPxMenu and ASPxSiteMapControl placed within ASPxMenu.SubMenuTemplate</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<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>
</div>
</form>
</body>
</html>
See Also