November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi Robin
If you want to create a dropdown that changes the languages based on what the user chooses take a look at the Alloy Demo templates.
The code looks something like this:
<asp:DropDownList runat="server" ID="LanguageList" Visible="false" AutoPostBack="true" OnSelectedIndexChanged="ChangeLanguage"> <asp:ListItem Text="Other languages" Value="noLangSelected" /> </asp:DropDownList>
/// <summary> /// Initializes the language link. /// Checks the number of available and enabled languages. If more than two, /// populates a dropdown-menu with the available and enabled languages. /// Otherwise sets the link to the not currently active language. /// </summary> private void SetLanguage() { PageDataCollection languageBranches = DataFactory.Instance.GetLanguageBranches(CurrentPage.PageLink); //Filter so pages with Replacement language is filtered away. new FilterReplacementLanguage().Filter(languageBranches); if (languageBranches.Count > 2) { LanguageList.Visible = LanguageListLabel.Visible = LanguageButton.Visible = LanguageList.Parent.Visible = true; foreach (PageData languageBranch in languageBranches.Where(p => p.LanguageID != CurrentPage.LanguageID && LanguageBranch.Load(p.LanguageID).Enabled)) { LanguageList.Items.Add(new System.Web.UI.WebControls.ListItem(new CultureInfo(languageBranch.LanguageID).NativeName, languageBranch.LanguageID)); } } else { foreach (PageData languageBranch in languageBranches.Where(p => p.LanguageID != CurrentPage.LanguageID && LanguageBranch.Load(p.LanguageID).Enabled)) { Language.Visible = Language.Parent.Visible = true; Language.NavigateUrl = EPiServer.UriSupport.AddLanguageSelection(languageBranch.LinkURL, languageBranch.LanguageID); Language.Text = Translate(new CultureInfo(languageBranch.LanguageID).NativeName); break; } } } /// <summary> /// Redirects to the selected language. /// </summary> public void ChangeLanguage(object sender, EventArgs e) { if (LanguageList.SelectedValue != "noLangSelected") { Response.Redirect(EPiServer.UriSupport.AddLanguageSelection(CurrentPage.LinkURL, LanguageList.SelectedValue)); } }
Hope this helps
Frederik
Hello, Im currently developing a website based on EPiServer CMS 6 r2 and are trying to access the values stored in Language Overview (Editmode -> StartPage -> Language Overview). I am curious about what the best way is to approach this, since i basicly just want the appropriate values for each language, i.e Norwegian, English and Swedish if a StartPage exists for these languages.
I've tried searching for an example that uses a repeater and hyperlink with the appropriate codebehind included, but i've had no luck so far. Im new to development, episerver and coding overall, so please excuse any mistakes. Thanks for your help!
ps. im using a javascript with jquery to create my dropdown menu.