This is the ascx markup, it contains the same markup that is used on the left menu in terms of categories and manufacturers, but it uses a Javascript dynamic menu from
http://www.javascriptkit.com/script/script2/jScale/:
<%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Modules.HeaderMegaMenu"
CodeBehind="HeaderMegaMenu.ascx.cs" %>
<script type="text/javascript" src="<%=CommonHelper.GetStoreLocation()%>Scripts/jquery.megamenu.js"></script>
<script type="text/javascript">
//jkmegamenu.definemenu("anchorid", "menuid", "mouseover|click")
jkmegamenu.definemenu("megaanchor", "megamenu1", "mouseover");
</script>
<li><a href="" id="megaanchor"><%=GetLocaleResourceString("Category.Categories")%></a></li>
<%--Mega Menu--%>
<!--Mega Drop Down Menu HTML. Retain given CSS classes-->
<div id="megamenu1" class="megamenu">
<div class="column">
<h3><%=GetLocaleResourceString("Category.Categories")%></h3>
<ul>
<asp:PlaceHolder runat="server" ID="phCategories" EnableViewState="false" />
</ul>
</div>
<div class="column">
<h3><%=GetLocaleResourceString("Manufacturer.Manufacturers")%></h3>
<asp:Repeater ID="rptrManufacturers" runat="server" OnItemDataBound="rptrManufacturers_ItemDataBound" EnableViewState="false">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:HyperLink ID="hlManufacturer" runat="server" Text='<%#Server.HtmlEncode(Eval("LocalizedName").ToString()) %>'
CssClass='<%# ((int)Eval("ManufacturerId") == this.ManufacturerId) ? "active" : "inactive" %>' />
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
<div class="viewall">
<a href="<%=CommonHelper.GetStoreLocation()%>manufacturers.aspx">
<%=GetLocaleResourceString("Manufacturer.ViewAll")%></a>
</div>
</div>
<br style="clear: left" />
<!--Break after 3rd column. Move this if desired-->
<br />
</div>
<%--@Mega Menu--%>
And the code behind uses the corresponding code that builds the category menu and manufacturers links on the NopCommerce distribution, I just copied the code and merged it (using sentences ommited, create them with Control + dot in Visual Studio):
namespace NopSolutions.NopCommerce.Web.Modules
{
public partial class TopicControl: BaseNopFrontendUserControl
{
private bool ValidatePassword()
{
bool passwordOK = true;
if (this.Topic != null)
{
if (this.Topic.IsPasswordProtected &&
!this.Topic.Password.Equals(this.EnteredPassword))
{
passwordOK = false;
}
}
return passwordOK;
}
protected void btnPassword_OnClick(object sender, EventArgs e)
{
this.EnteredPassword = txtPassword.Text;
bool passwordOK = ValidatePassword();
if (!passwordOK)
{
lError.Text = GetLocaleResourceString("TopicPage.WrongPassword");
}
BindData();
}
private void BindData()
{
if (this.LocalizedTopic != null)
{
bool passwordOK = ValidatePassword();
if (passwordOK)
{
phPassword.Visible = false;
lTitle.Visible = true;
lBody.Visible = true;
if (!string.IsNullOrEmpty(this.LocalizedTopic.Title))
{
lTitle.Text = Server.HtmlEncode(this.LocalizedTopic.Title);
}
else
{
lTitle.Visible = false;
}
if (!string.IsNullOrEmpty(this.LocalizedTopic.Body))
{
lBody.Text = this.LocalizedTopic.Body;
}
else
{
lBody.Visible = false;
}
}
else
{
phPassword.Visible = true;
lTitle.Visible = false;
lBody.Visible = false;
}
}
else
{
this.Visible = false;
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.BindData();
if (this.LocalizedTopic != null)
{
if (this.OverrideSEO)
{
//title
string title = this.LocalizedTopic.MetaTitle;
if (String.IsNullOrEmpty(title))
title = this.LocalizedTopic.Title;
if (!string.IsNullOrEmpty(title))
SEOHelper.RenderTitle(this.Page, title, true);
//meta
if (!String.IsNullOrEmpty(this.LocalizedTopic.MetaDescription))
SEOHelper.RenderMetaTag(this.Page, "description", this.LocalizedTopic.MetaDescription, true);
if (!String.IsNullOrEmpty(this.LocalizedTopic.MetaKeywords))
SEOHelper.RenderMetaTag(this.Page, "keywords", this.LocalizedTopic.MetaKeywords, true);
}
}
}
protected override void OnPreRender(EventArgs e)
{
//default button
this.txtPassword.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnPassword.ClientID + "').click();return false;}} else {return true}; ");
base.OnPreRender(e);
}
private LocalizedTopic localizedTopic = null;
public LocalizedTopic LocalizedTopic
{
get
{
if (localizedTopic == null)
{
localizedTopic = this.TopicService.GetLocalizedTopic(this.TopicName, NopContext.Current.WorkingLanguage.LanguageId);
}
return localizedTopic;
}
}
public Topic Topic
{
get
{
if (this.LocalizedTopic != null)
return this.LocalizedTopic.Topic;
else
return null;
}
}
public string TopicName
{
get
{
object obj2 = this.ViewState["TopicName"];
if (obj2 != null)
return (string)obj2;
else
return string.Empty;
}
set
{
this.ViewState["TopicName"] = value;
}
}
[DefaultValue(true)]
public bool OverrideSEO
{
get
{
object obj2 = this.ViewState["OverrideSEO"];
if (obj2 != null)
return (bool)obj2;
else
return true;
}
set
{
this.ViewState["OverrideSEO"] = value;
}
}
public string EnteredPassword
{
get
{
object obj2 = this.ViewState["EnteredPassword"];
if (obj2 != null)
return (string)obj2;
else
return string.Empty;
}
set
{
this.ViewState["EnteredPassword"] = value;
}
}
}
}