aspx code:
<telerik:RadSiteMap ID="BreadCrumbSiteMap" runat="server" DataTextField="Text" DataNavigateUrlField="NavigateUrl">
<DefaultLevelSettings ListLayout-RepeatDirection="Horizontal" SeparatorText="/" Layout="Flow" />
</telerik:RadSiteMap>
csharp code:
protected void Page_Load(object sender, EventArgs e)
{
RadMenuItem currentItem = RadMenu.FindItemByUrl(Request.Url.PathAndQuery);
if (currentItem != null)
{
currentItem.HighlightPath();
DataBindBreadCrumbSiteMap(currentItem);
}
else
RadMenu.Items[0].HighlightPath();
}
private void DataBindBreadCrumbSiteMap(RadMenuItem currentItem)
{
List
while (currentItem != null)
{
breadCrumbPath.Insert(0, currentItem);
currentItem = currentItem.Owner as RadMenuItem;
}
BreadCrumbSiteMap.DataSource = breadCrumbPath;
BreadCrumbSiteMap.DataBind();
}
The solution is from here: http://demos.telerik.com/aspnet-ajax/menu/examples/programming/showpath/defaultcs.aspx?Page=Blogs
Hiç yorum yok:
Yorum Gönder