Check if a page exist on a specific language

Vote:
 
Hi! Is it possible to check wether a page exist on a specific language (when using MultiLanguage). For example: I want to be able to give the user a message when surfing on the english version of a page that "this page doesn't exist in swedish" And this message should appear when the current page isn't translated or isn't published into swedish. //Stefan
#12147
Oct 08, 2004 14:58
Vote:
 
Hi Isn't it better to prevent the user to see pages that does not exist in the current language by a filter? Add this filter function to the page/control that should filter on current language 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
#13734
Oct 19, 2004 19:50
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.