Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
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