
When moving a sorted column bind to objects of nullable type (DateTime?, int? etc) i get an error. Is this a know bug?
Best regards
Erik
3 Answers, 1 is accepted
Thank you for contacting us.
This was not a known issue and I was able to reproduce it thanks to the information that you provided. Unfortunately, the issue is at the very base level of RadGridView, so I cannot provide you with any specific time frame when it will be addressed.
I am updating your Telerik points for the report. If you have additional questions, feel free to contact me.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

void
dataGrid_ColumnIndexChanged(object sender, ColumnIndexChangedEventArgs e)
{
if (currentSortFieldList != null && currentNullableColumn != null && this.dataGrid.Columns[e.NewIndex] == currentNullableColumn)
{
// Apply the sorting again
foreach (GridSortField sortFiled in currentSortFieldList)
{
this.dataGrid.MasterGridViewTemplate.SortExpressions.Add(sortFiled);
}
}
}
GridViewDataColumn currentNullableColumn = null;
List<GridSortField> currentSortFieldList = null;
void dataGrid_ColumnIndexChanging(object sender, ColumnIndexChangingEventArgs e)
{
if (this.dataGrid.Columns[e.OldIndex].IsSorted){
// Enable to move sorted columns of nullable type
if (
this.dataGrid.Columns[e.OldIndex].DataType.IsGenericType
&&
this.dataGrid.Columns[e.OldIndex].DataType.GetGenericTypeDefinition() == typeof(Nullable<>)
)
{
// Save current data
currentNullableColumn =
this.dataGrid.Columns[e.OldIndex];
// Save current sorted fields
if (currentSortFieldList == null)
{
currentSortFieldList =
new List<GridSortField>();
}
else
{
currentSortFieldList.Clear();
}
foreach (GridSortField sortFiled in this.dataGrid.MasterGridViewTemplate.SortExpressions)
{
currentSortFieldList.Add(sortFiled);
}
// Remove sortexpressions as a work around to avoid known bug
this.dataGrid.MasterGridViewTemplate.SortExpressions.Clear();
}
}
}

regards
Erik