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();
}
}
listitem
, can you please use theasp:DropDownList