Skip to main content
added 56 characters in body
Source Link
Hishaam Namooya
  • 9.7k
  • 1
  • 19
  • 37

I want to create language selector in the site header. So for that i am trying to pick all language(/sitecore/system/Languages) from Sitecore dynamically using repeater. I am able to get language values from Sitecore but in the page i am not getting language dropdown.

My view Code : Select Language: <asp:Repeater ID="rpLang" ItemType="Sitecore.Data.Items.Item" runat="server"> <listitem text=<%#: Item.Name %> runat="server"/> </asp

    <div class="ddlCountry"> Select Language:
    <asp:Repeater ID="rpLang" ItemType="Sitecore.Data.Items.Item" runat="server">
        <HeaderTemplate>
            <DropDownList> 
        </HeaderTemplate>
        <ItemTemplate>
            <listitem text=<%#: Item.Name %> runat="server"/>
             </ItemTemplate>
        <FooterTemplate>
            </DropDownList>
        </FooterTemplate>
    </asp:Repeater>
</div>

My Back-end Code:Repeater>

My Back-end Code:
public partial class CountryRegionSublayout : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Item lang = Sitecore.Context.Database.GetItem("/sitecore/system/Languages");
        
            Item[] children = lang.Children.ToArray();
            rpLang.DataSource = children;
            rpLang.DataBind();

        
    }
}

I want to create language selector in the site header. So for that i am trying to pick all language(/sitecore/system/Languages) from Sitecore dynamically using repeater. I am able to get language values from Sitecore but in the page i am not getting language dropdown.

My view Code : Select Language: <asp:Repeater ID="rpLang" ItemType="Sitecore.Data.Items.Item" runat="server"> <listitem text=<%#: Item.Name %> runat="server"/> </asp:Repeater>

My Back-end Code:
public partial class CountryRegionSublayout : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Item lang = Sitecore.Context.Database.GetItem("/sitecore/system/Languages");
        
            Item[] children = lang.Children.ToArray();
            rpLang.DataSource = children;
            rpLang.DataBind();

        
    }
}

I want to create language selector in the site header. So for that i am trying to pick all language(/sitecore/system/Languages) from Sitecore dynamically using repeater. I am able to get language values from Sitecore but in the page i am not getting language dropdown.

My view Code :

    <div class="ddlCountry"> Select Language:
    <asp:Repeater ID="rpLang" ItemType="Sitecore.Data.Items.Item" runat="server">
        <HeaderTemplate>
            <DropDownList> 
        </HeaderTemplate>
        <ItemTemplate>
            <listitem text=<%#: Item.Name %> runat="server"/>
             </ItemTemplate>
        <FooterTemplate>
            </DropDownList>
        </FooterTemplate>
    </asp:Repeater>
</div>

My Back-end Code:

public partial class CountryRegionSublayout : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Item lang = Sitecore.Context.Database.GetItem("/sitecore/system/Languages");
        
            Item[] children = lang.Children.ToArray();
            rpLang.DataSource = children;
            rpLang.DataBind();

        
    }
}
Source Link
richa
  • 47
  • 6

How to create Dropdown dynamically for Sitecore languages in Sitecore(8.2) Web forms?

I want to create language selector in the site header. So for that i am trying to pick all language(/sitecore/system/Languages) from Sitecore dynamically using repeater. I am able to get language values from Sitecore but in the page i am not getting language dropdown.

My view Code : Select Language: <asp:Repeater ID="rpLang" ItemType="Sitecore.Data.Items.Item" runat="server"> <listitem text=<%#: Item.Name %> runat="server"/> </asp:Repeater>

My Back-end Code:
public partial class CountryRegionSublayout : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Item lang = Sitecore.Context.Database.GetItem("/sitecore/system/Languages");
        
            Item[] children = lang.Children.ToArray();
            rpLang.DataSource = children;
            rpLang.DataBind();

        
    }
}