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
Mar 25, 2008 18:35
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
Mar 25, 2008 18:46
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
Mar 25, 2008 18:46
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
Mar 25, 2008 18:46
Vote:
 
Have you tried SortOrder="Index" on the PageList control? Instead of SortBy /HAXEN
#15101
Mar 25, 2008 18:46
Vote:
 
Tried everything. Nothing work!
#15102
Mar 25, 2008 18:46
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
Mar 25, 2008 18:46
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
Mar 25, 2008 18:46
* 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.