RadGrid: Inconsistent Sorting and Row Selection Behavior with Duplicate Values

1 Answer 27 Views
Grid
Harini
Top achievements
Rank 1
Harini asked on 04 Dec 2025, 08:18 PM

Hello Telerik Support,

We are experiencing an issue with the RadGrid control when sorting by a single column that contains many duplicate values. The ordering of the results is inconsistent, which can confuse users. Additionally, in some cases, selecting a row causes the grid to re-sort unexpectedly, rather than navigating to the selected record’s page.

This behavior only occurs when sorting by a single column with non-unique values. When sorting by multiple columns, the ordering and navigation work as expected.

Could you please advise on:
How to ensure stable and predictable sorting in RadGrid when sorting by columns with duplicate values?
Best practices for maintaining consistent row selection and navigation behavior in these scenarios?

We are targeting .NET Framework 4.8.

Thank you for your assistance.

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 05 Dec 2025, 07:24 AM

Hello, Harini,

We will be glad to assist you on this case, but can you first share which product are you using when you face the issue so I can forward it to the corresponding team?

Kind regards,
Vessy
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Harini
Top achievements
Rank 1
commented on 08 Dec 2025, 04:42 PM

We are using Telerik RadGrid control (Telerik.Web.UI version 2024.3.805.462). 

Thanks,

Harini

Vasko
Telerik team
commented on 09 Dec 2025, 12:21 PM

Hi Harini,

My name is Vasko and I am part of the Telerik UI for ASP.NET AJAX team. 

The behavior you are describing is rather strange, as sorting appears to work fine when there are duplicate values in the column. Can you test with the below Grid configuration and see if the aforementioned issues can be observed?

<telerik:RadGrid ID="RadGrid1" runat="server"
    AllowPaging="True"
    AllowSorting="true"
    Width="800px"
    OnNeedDataSource="RadGrid1_NeedDataSource"
    OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID">
        <Columns>
            <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32"
                HeaderText="OrderID" ReadOnly="True"
                SortExpression="OrderID" UniqueName="OrderID" />
            <telerik:GridBoundColumn DataField="ShipCountry"
                HeaderText="ShipCountry"
                SortExpression="ShipCountry" UniqueName="ShipCountry" />
            <telerik:GridBoundColumn DataField="ShipName"
                HeaderText="ShipName"
                SortExpression="ShipName" UniqueName="ShipName" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    (sender as RadGrid).DataSource = OrdersTable();
}

private DataTable OrdersTable()
{
    DataTable dt = new DataTable();

    dt.Columns.Add(new DataColumn("OrderID", typeof(int)));
    dt.Columns.Add(new DataColumn("ShipName", typeof(string)));
    dt.Columns.Add(new DataColumn("ShipCountry", typeof(string)));

    dt.PrimaryKey = new DataColumn[] { dt.Columns["OrderID"] };

    // deterministic list with many duplicates
    string[] countries = new[]
    {
        "USA","USA","USA","USA","USA",
        "Germany","Germany","Germany","Germany",
        "UK","UK","UK",
        "Brazil","Brazil",
        "Canada","France"
    };

    for (int i = 0; i < 20; i++)
    {
        DataRow row = dt.NewRow();

        row["OrderID"] = i + 1;
        row["ShipName"] = "Customer " + (i + 1);
        row["ShipCountry"] = countries[i % countries.Length];

        dt.Rows.Add(row);
    }

    return dt;
}



protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{

}

    Regards,
    Vasko
    Progress Telerik

    Tags
    Grid
    Asked by
    Harini
    Top achievements
    Rank 1
    Answers by
    Vessy
    Telerik team
    Share this question
    or