Hello, Martin,
In the
CustomSorting event the Handled argument of the
GridViewCustomSortingEventArgs allows you to control whether the default sorting logic will control the sort order of the rows (by setting the Handled argument to false) or your custom logic will be applied (by setting the Handled argument to true) via setting the
SortResult.
The following code snippet demonstrates a sample approach how to apply custom sorting only for the
ProductID column and leaжe the basic sorting for the rest of the columns:
private void RadForm1_Load(object sender, EventArgs e)
{
this.productsTableAdapter.Fill(this.nwindDataSet.Products);
this.radGridView1.BestFitColumns();
this.radGridView1.EnableCustomSorting = true;
this.radGridView1.CustomSorting += radGridView1_CustomSorting;
}
private void radGridView1_CustomSorting(object sender, GridViewCustomSortingEventArgs e)
{
if (this.radGridView1.SortDescriptors.Contains("ProductID"))
{
e.Handled = true;
e.SortResult = e.Row1.Cells["ProductID"].Value.ToString().CompareTo(e.Row2.Cells["ProductID"].Value.ToString());
}
else
{
e.Handled = false;
}
}
Please refer to the following help article which demonstrates how to use the custom filtering logic:
https://docs.telerik.com/devtools/winforms/controls/gridview/sorting/custom-sorting I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get
quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.
Learn More.