RadListBox Sorting

2 posts, 0 answers
  1. Mel
    Mel avatar
    1 posts
    Member since:
    Apr 2015

    Posted 23 Apr 2015 Link to this post

    I'm unable to get a RadListBox to sort.

    .Net 4.5; version 2015.1.225.45

    Here is the code below:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="WebApplication1._default" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
                <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="false" />
                <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" CssClass="demo-containers">
                    <div class="demo-container size-thin">
                        <telerik:RadListBox
                            ID="RadListBox1"
                            runat="server"
                            Sort="Descending"
                            DataSortField="t" 
                            CheckBoxes="true"
                            ShowCheckAll="true" >
                        </telerik:RadListBox>
                    </div>
            </telerik:RadAjaxPanel>
         </form>
    </body>
    </html>

     

           protected void Page_Load(object sender, EventArgs ed)
            {
                DataTable dt = new DataTable();
                dt.Clear();
                dt.Columns.Add("v");
                dt.Columns.Add("t");
                DataRow a = dt.NewRow();
                a["v"] = "1"; a["t"] = "a";
                dt.Rows.Add(a);
                DataRow b = dt.NewRow();
                b["v"] = "2"; b["t"] = "f";
                dt.Rows.Add(b);
                DataRow c = dt.NewRow();
                c["v"] = "3"; c["t"] = "d";
                dt.Rows.Add(c);
                DataRow d = dt.NewRow();
                d["v"] = "4";d["t"] = "x";
                dt.Rows.Add(d);
                DataRow e = dt.NewRow();
                e["v"] = "5"; e["t"] = "b";
                dt.Rows.Add(e);
               
                RadListBox1.DataSource = dt;
                RadListBox1.DataTextField = "t";
                RadListBox1.DataValueField = "v";
                RadListBox1.DataBind();
            }
      

     

  2. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 24 Apr 2015 Link to this post

    Hello,

    Please refer to the following forum thread, which covers hot to get the sorting to work:
    http://www.telerik.com/forums/sorting-content-listbox

    Regards,
    Bozhidar
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top