Sort MultiSelect on page Init

  1. #1

    Sort MultiSelect on page Init

    I have a Multiselect box that I am trying to get to sort alphabetically. I populate it on Page_init with text and values from a search string. Code is here:
    For Each Member As Object In CType(Members, IEnumerable)  ' loop through members
    
                Dim CurrentMember As New DirectoryEntry(Member) ' Get directoryentry for user
    
    
                UList.Add(CurrentMember.Name.Remove(0, 3))
                EList.Add(CurrentMember.Properties("mail").Value.ToString)
    
                Dim c As New Ext.Net.ListItem.Config
                c.Text = CurrentMember.Name.Remove(0, 3)
                c.Value = CurrentMember.Properties("mail").Value.ToString
                MultiSelect1.Items.Add(New Ext.Net.ListItem(c))
    
    
            Next
    I have this code in my aspx page
    <ext:MultiSelect ID="MultiSelect1" runat="server" SubmitText = "true"  Height="500" Width="200" Direction ="ASC" SortField = "text"></ext:MultiSelect>
    But it does not seem to work at all, is there something I am missing? Any help is greatly appreciated.
  2. #2
    Hi,

    Could you sort the data ASC before adding to the MultiSelect?
    Geoffrey McGill
    Founder
  3. #3
    I could but I would have to add it to another array/list first and I am trying to avoid the extra overhead. I would like to keep it coming directly from the search results.
  4. #4
    Hi,

    You can
    - use Store control instead inner Items and set SortInfo for default sorting
    - or please use the following listener for the MultuSelect
    <AfterRender Handler="this.store.sort('text');"/>
    or
    <AfterRender Handler="this.store.sort('value');"/>
  5. #5
    That was it, thanks a lot, much appreciated. How do I mark this as solved?

Similar Threads

  1. Replies: 4
    Last Post: May 09, 2012, 9:24 PM
  2. Replies: 4
    Last Post: Jul 25, 2011, 4:57 PM
  3. Replies: 0
    Last Post: Mar 01, 2011, 12:09 PM
  4. Replies: 0
    Last Post: Jan 13, 2011, 10:55 AM
  5. MultiSelect Sort AfterDrop
    By BillyZ313 in forum 1.x Help
    Replies: 9
    Last Post: Apr 15, 2010, 6:45 PM

Tags for this Thread

Posting Permissions