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
private void FilterOnLanguage(object sender, EPiServer.Filters.FilterEventArgs e)
{
EPiServer.Core.PageDataCollection pages = e.Pages;
string menuPropertyName = "PageName___";
string languageId = "SV"; //default language
HttpCookie cookie = Request.Cookies["epslanguage"]; //check the current language
if (cookie != null && cookie.Value != "")
{
languageId = cookie.Value;
}
menuPropertyName += languageId;
for (int i = 0; i < pages.Count; i++)
{
if (pages[i].Property[menuPropertyName] == null ||
pages[i].Property[menuPropertyName].ToString() == "")
{
pages.RemoveAt(i); //remove all pages that does not a PageName in current language
i--;
}
}
}
and add this somewhere before the databinding of the control
this.MenuListControl.Filter += new FilterEventHandler (FilterOnLanguage);
It working so far
best regards
/Stefan