Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
<%@ control language="C#" autoeventwireup="true" codebehind="LeftMenu.ascx.cs" inherits="testSite.Web.templates.Controls.LeftMenu"> <%@ register tagprefix="EPiServer" namespace="EPiServer.WebControls" assembly="EPiServer">
<%# rendermenuitemcontainer.currentpage>
%#>
<%# rendermenuitemcontainer.currentpage>
%#>
<%# rendermenuitemcontainer.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