Hi I need retain the Satete of the panelbar after navigation, but also I need use databind this to SiteMapDataSource
This is the code that I use, but not Working, (the idea is expand the parent and set to selected the item node that match with the url (Or cointains this))
what is bad in the code?
<telerik:RadPanelBar RenderMode="Lightweight" OnItemDataBound="RadPanelBar1_ItemDataBound"
ID="RadPanelBarMenu" ViewStateMode="Enabled" EnableViewState="true" runat="server" Width="100%" ExpandMode="SingleExpandedItem"
DataSourceID="SiteMapDataSource1" DataFieldID="id" DataFieldParentID="ParentId" DataTextField="">
<DataBindings>
<telerik:RadPanelItemBinding Depth="0" Expanded="true" />
</DataBindings>
</telerik:RadPanelBar>
<asp:SiteMapDataSource runat="server" ID="SiteMapDataSource1" ShowStartingNode="false"></asp:SiteMapDataSource>
In code Behind
protected void RadPanelBar1_ItemDataBound(object sender, RadPanelBarEventArgs e)
{
System.Web.SiteMapNode row = (System.Web.SiteMapNode)e.Item.DataItem;
string url_menu = row.Url.Replace(".aspx", "").ToLower();
if (!string.IsNullOrEmpty(row.Url) && Request.Url.AbsoluteUri.ToLower().Contains(url_menu))
{
e.Item.Selected = true;
e.Item.ExpandParentItems();
}
}
The sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="All">
<siteMapNode title="APP">
<siteMapNode title="Historical" url="~/webpages/HistoricalAppMobileSender.aspx" />
<siteMapNode title="Message" url="~/webpages/AppMobileSender.aspx" />
<siteMapNode title="Agenda" url="~/webpages/Scheduler.aspx" />
</siteMapNode>
</siteMap>