Sort items in LoadOnDemand

3 posts, 1 answers
  1. Udi
    Udi avatar
    36 posts
    Member since:
    Sep 2010

    Posted 12 Nov 2010 Link to this post

    Hello,

    I was trying to sort items while LoadOnDemand property set to true.
    I put the SortItems() method inside the ItemsRequested event handler and set the Sort="Ascending" but nothing happend.
    do i miss something?

    I would like to sort the items during i load on demand is true.

    Thanks
    Oren
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Nov 2010 Link to this post

    Hello,
    I have tried the similar scenario in my application and that worked for me.Please check with the following code and find what is missing.

    C#:
    protected void rcbProva_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
       {
           RadComboBox combo = (RadComboBox)o;
           combo.Items.Clear();
           SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["NorthwindConnectionString2"].ConnectionString);
           SqlCommand cmd = new SqlCommand("select EmployeeID,FirstName from Employees where FirstName LIKE '" + e.Text + "%'", con);
           SqlDataAdapter da = new SqlDataAdapter(cmd);
           DataTable dt = new DataTable();
           da.Fill(dt);
           con.Close();
           foreach (DataRow row in dt.Rows)
           {
               RadComboBoxItem item = new RadComboBoxItem(row["FirstName"].ToString());
               combo.Items.Add(item);
           }
           combo.Sort = RadComboBoxSort.Ascending;
           combo.SortItems();
       }
     
     Please paste your code if it doesn't help .

    Thanks,
    Princy.
  3. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Nov 2010 Link to this post

    .
Back to Top