Try our conversational search powered by Generative AI!

LanguageSelector

Vote:
 
I posted about this one earlier, and thought I had found the solution myself, but that wasn't the case. Question is really simple; How do I manage to make the flag-icons in the language selector-control, appear in a certain predefined order. I try to set the sorting index for every used language, and then -in the pageList-control set the SortBy property to "index", but even though some sorting accually occur, it's not at all the same as I have defined in the sorting index for the languages. How do I solve this? //
#12924
Feb 05, 2007 14:18
Vote:
 
Hi... In database the sortingindex comun is named SortIndex. I have also tried sortBy="SortIndex" whithout any success! Please post the solution here :)
#15098
Feb 07, 2007 8:45
Vote:
 
If you have a look in the SDK documentation, some of the 'built-in' properties have names you might not expect - for instance, what is shown as SortIndex in the Editor is actually called PagePeerOrder, so sortby="PagePeerOrder" might work.
#15099
Feb 07, 2007 14:35
Vote:
 
Did not work, I'm sorry to say. This seem like a basic thing, so I'm surprised noone have a quick and simple answer.
#15100
Feb 08, 2007 15:39
Vote:
 
Have you tried SortOrder="Index" on the PageList control? Instead of SortBy /HAXEN
#15101
Feb 09, 2007 10:47
Vote:
 
Tried everything. Nothing work!
#15102
Feb 14, 2007 14:03
Vote:
 
There is no sortorder defined for LanguageSelector. The index is used for internal sorting. The reason for this is that if an admin changes the language index for some reason it would effect the appearance of the website. But we have written some examlple code if you still want this feature or to get other sorting idéas. using System.Collections; . . . . public class LanguageSelector : EPiServer.UserControlBase { private class LangSort : IComparer { int IComparer.Compare(object x, object y) { PageData pageX = x as PageData; PageData pageY = y as PageData; if (pageX != null || pageY != null) { LanguageBranch langX = LanguageBranch.Load(pageX.LanguageBranch); LanguageBranch langY = LanguageBranch.Load(pageY.LanguageBranch); return langX.SortIndex.CompareTo(langY.SortIndex); } else return 0; //**** Handle as you see fit } } protected PageList languageList; private void Page_Load(object sender, System.EventArgs e) { if(Configuration.EnableGlobalizationSupport && CurrentPage.PageLink.IsValue()) { PageDataCollection pages = Global.EPDataFactory.GetLanguageBranches(CurrentPage.PageLink); pages.Sort(new LangSort() ); languageList.DataSource = pages; languageList.DataBind(); } else Visible = false; }
#15103
Feb 20, 2007 16:50
Vote:
 
Thanks, I will check it out sometime. For now, I've solved it by hard-coding the icon-menu, wich is a bit risky, but it will work in my case.
#15104
Feb 22, 2007 15:14
* 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.