Hello all.
I've got this code used to display a left menu on a testsite i've done:
<%@ control language="C#" autoeventwireup="true" codebehind="LeftMenu.ascx.cs" inherits="testSite.Web.templates.Controls.LeftMenu" %>
<%@ register tagprefix="EPiServer" namespace="EPiServer.WebControls" assembly="EPiServer" %>
%@>%@>
And the code behind looks like this:
namespace testSite.Web.templates.Controls {
public partial class LeftMenu : Classes.testSiteUserControlBase {
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
PageTreeControl.PageLink = new PageReference(TopMenuLevelId);
PageTreeControl.DataBind();
}
}
public string RenderMenuItem(PageData pd) {
if (pd.Property["MenuImage"].ToString().Length > 0)
return String.Format("", pd.Property["MenuImage"], pd.PageName);
return String.Format("{1}", pd.LinkURL, pd.PageName);
}
}
What I want to do is do show the FIRST two levels in the pagetree. If not klicked. Otherwise I want to expand the rest.
Right now it displays all of the levels. And if I set ExpandAll="true" then all of the levels in the menu are displayed. I just want to display the first 2 levels.
Anyone know how to do that?
Kind regards,
-- Jon
<%@ control language="C#" autoeventwireup="true" codebehind="LeftMenu.ascx.cs" inherits="testSite.Web.templates.Controls.LeftMenu" %> <%@ register tagprefix="EPiServer" namespace="EPiServer.WebControls" assembly="EPiServer" %>
<%# rendermenuitem(container.currentpage)%>
%#>
<%# rendermenuitem(container.currentpage)%>
%#>
<%# rendermenuitem(container.currentpage)%>%#>
%@>%@>
And the code behind looks like this:namespace testSite.Web.templates.Controls { public partial class LeftMenu : Classes.testSiteUserControlBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PageTreeControl.PageLink = new PageReference(TopMenuLevelId); PageTreeControl.DataBind(); } } public string RenderMenuItem(PageData pd) { if (pd.Property["MenuImage"].ToString().Length > 0) return String.Format("", pd.Property["MenuImage"], pd.PageName); return String.Format("{1}", pd.LinkURL, pd.PageName); } }
What I want to do is do show the FIRST two levels in the pagetree. If not klicked. Otherwise I want to expand the rest. Right now it displays all of the levels. And if I set ExpandAll="true" then all of the levels in the menu are displayed. I just want to display the first 2 levels. Anyone know how to do that? Kind regards, -- Jon