Customize Menu Items in Sitefinity with Title and Description
I need to customize my navigation menu items. I need to have the second level items with Title and Description. Attached is the image how it should look like, also the current version is attached.
Currently I have added the Navigation Widget in my page with Horizontal with DropDown. There is also a custom template for little changes.
Here is it:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
<telerik:RadMenu ID="Menu" runat="server" Skin="" ExpandAnimation-Type="None" CollapseAnimation-Type="None" MaxDataBindDepth="2" DataSourceID="SitemapDataSource1" CssClass="RadMenu_mainmenu" >
</telerik:RadMenu>
Please help me with this. The description added can come from the Description of the Page in backend.
Thanks!
Can someone help me with this ??? its kinda urgent....
Also, I want to know how to use the SitefinitySiteMapDataSource. This comes from Telerik.Sitefinity.Web.UI.NavigationControls. But this dll file is not present in my bin. Where can I get this file ??
Hello Prateek,
Here's a sample template for the default navigation, where on ItemDataBound you can add the Page description to each item and achieve the desired result:
.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RadMenu2.ascx.cs" Inherits="SitefinityWebApp.RadMenu2" %><%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %><telerik:RadMenu ID="Menu" runat="server" Skin="" ExpandAnimation-Type="None" CollapseAnimation-Type="None" MaxDataBindDepth="2" CssClass="RadMenu_mainmenu" OnItemDataBound="Menu_ItemDataBound" ></telerik:RadMenu>using Telerik.Web.UI;namespace SitefinityWebApp public partial class RadMenu2 : System.Web.UI.UserControl protected void Page_Load(object sender, EventArgs e) protected void Menu_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e) var item = e.Item as RadMenuItem; if (item != null) var pageNode = item.DataItem as PageSiteNode; var page = App.WorkWith().Pages().Where(p => p.Title == pageNode.Title).Get().FirstOrDefault(); var description = page.Page.Description[CultureInfo.CurrentUICulture]; item.Text += " " + description; Hello Jen,
I implemented the menu as you said but I get an error:
Telerik.Sitefinity.Pages.Model.PageNode, Telerik.Sitefinity.Model was not granted View in Pages for principals with IDs 00000000-0000-0000-0000-000000000000
And this error comes from this line:
var page = App.WorkWith().Pages().Where(p => p.Title == pageNode.Title).Get().FirstOrDefault();
Please help.
Thanks!
Hi Prateek,
Most probably the error is thrown because you are not logged in or you are, but with a user that does not have permission to view the page. This has been discussed previously in the forums. Please take a look at the following threads for further information: