The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MagaMenuTemplate.ascx.cs" Inherits="SitefinityWebApp.ControlTemplates22.MegaMenuTemplate"
%>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls.SiteMapNavigations" TagPrefix="navcontrols" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %>
<
navcontrols:SiteMapNavigationMenu
ID
=
"siteMapControl_horizontaldropdownmenu"
runat
=
"server"
Skin
=
"Sitefinity"
>
</
navcontrols:SiteMapNavigationMenu
>
<
script
type
=
"text/javascript"
>
function radMenuOnClick(sender, args) {
var state = args.get_item().get_attributes().getAttribute("ExpandOnClick");
args.get_item().get_attributes().setAttribute("ExpandOnClick", "true")
args.get_item().open();
}
function radMenuOnOpening(sender, args) {
var state = args.get_item().get_attributes().getAttribute("ExpandOnClick");
if (state != "true")
args.set_cancel(true);
args.get_item().get_attributes().setAttribute("ExpandOnClick", "false")
}
$(document).ready(function() {
var mainNavigation = $(".main-menu .floor2 .menuwrap .RadMenu.RadMenu_Sitefinity .rmRootGroup.rmHorizontal");
//$(".main-menu .floor2 .menuwrap .RadMenu.RadMenu_Sitefinity .rmRootGroup.rmHorizontal li:nth-child(2) div.rmSlide").addClass("members");
});
</
script
>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls.SiteMapNavigations" TagPrefix="navcontrols" %>
var templateInfo =
new
TemplateInfo()
{
TemplatePath =
"~/ControlTemplates/ItemTemplate.ascx"
,
TemplateName = String.Empty,
TemplateResourceInfo =
this
.ResourcesAssemblyInfo,
ControlType =
this
.GetType(),
Key = TemplateKey
};
<%@ Control Language="C#" AutoEventWireup="true" %>
<
telerik:RadSiteMap
runat
=
"server"
ID
=
"RadSiteMap1"
DataSourceID
=
"siteMapDataSource1"
></
telerik:RadSiteMap
>
<
asp:SiteMapDataSource
runat
=
"server"
ID
=
"siteMapDataSource1"
/>
((SiteMapBase)menuItemContainer.SiteMapDataSourceControl.Provider).IsNodeAccessible +=
new
EventHandler<IsAccessibleArgs>
void
MegaMenuTemplate_IsNodeAccessible(
object
sender, IsAccessibleArgs e)
{
var pageNode = e.Node
as
PageSiteNode;
if
(pageNode !=
null
)
{
if
(
/*!pageNode.ShowInNavigation ||*/
/*(!pageNode.IsGroupPage && pageNode.Hidden ) ||*/
(String.IsNullOrEmpty(pageNode.Title) &&
// used in multilingual; captures the cases of synced, split, and group pages
pageNode.Id != SiteInitializer.CurrentFrontendRootNodeId))
// ensures that the root node is not hidden and thus all other pages
{
e.IsAccessible =
false
;
return
;
}
//The page should be hidden if it is a group page and it has no child pages.
if
(pageNode.IsGroupPage && pageNode.ChildNodes.Count < 1)
{
e.IsAccessible =
false
;
return
;
}
if
(pageNode.ShowInNavigation ==
false
)
{
e.IsAccessible =
false
;
return
;
}
if
(pageNode.Title !=
"Pages"
&& pageNode.Status != Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
{
e.IsAccessible =
false
;
return
;
}
}
else
{
throw
new
NotSupportedException(
"The supported types are 'TaxonSiteNode' or 'PageSiteNode'."
);
}
e.IsAccessible =
true
;
}
public
class
ItemContainer : GenericContainer
{
public
ImageControl ImageControl
{
get
{
return
this
.GetControl<ImageControl>(
"imageControl"
,
false
);
}
}
public
Label Description
{
get
{
return
this
.GetControl<Label>(
"description"
,
false
);
}
}
public
HyperLink ItemUrl
{
get
{
return
this
.GetControl<HyperLink>(
"itemUrl"
,
false
);
}
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ItemTemplateRadItem.ascx.cs" Inherits="SitefinityWebApp.ItemTemplateRadItem" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls" TagPrefix="sf" %>
<
asp:Label
runat
=
"server"
ID
=
"description"
/>
<
sf:ImageControl
runat
=
"server"
id
=
"imageControl"
/>
<
asp:HyperLink
runat
=
"server"
ID
=
"itemUrl"
/>
if
(image !=
null
)
{
menuItemContainer.ImageControl.ImageId = image.Id;
shouldAdd =
true
;
}
if
(!description.IsNullOrEmpty())
{
menuItemContainer.Description.Text = description;
shouldAdd =
true
;
}
if
(shouldAdd)
{
e.Item.Controls.Add(menuItemContainer);
}
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.