Sorted LDAP Query

Hi,

 

i want sort a LDAP Query. Is there any Idea to make a sort LDAP Query?

 

Greetings

Charly

Tagged:

Comments

  • Hi,

     

    I am having the same issue with sorting LDAP queries although I suspect it isn't possible. Anyone able to confirm or deny?

     

    Cheers,

     

    Chris

  • Hi all,

     

    In case there is anyone else looking for the ability to sort an LDAP query I found a workaround.

     

    Promote a method from a server side script as below, pass it the instance of your LDAP BO and bind your dropdown/list field to the return value.

     

    public static List SortLDAPQuery(LDAP_BO ldap)
    {
      DataSet ds = ldap.Read();
      string[] sortedArr = new string[ds.Tables[0].Rows.Count];
    
      for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
      {
        sortedArr[i] = ds.Tables[0].Rows[i][0];
      }
    
      Array.Sort(sortedArr);
    
      return new List(sortedArr);  
    }
    

     

    Hope that helps!