Hello everyone
I'm trying to sort a RadGridView by clicking a header cell. The name of the column which should be sorted is "priority" and it's type is double. I have some other column which has different values. All these columns together build a "priority number" like 1.0, 2.0, 2.1 etc. And this "priority number" is in column called "priority". And now I'm trying to sort the priority column. It shouldn't matter which column header i click, it just have to sort the priority column. I tried this code:
private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (e.RowIndex == -1)
{
if (e.Column.Name == "va")
{
if (radGridView1.Columns["priority"].SortOrder == RadSortOrder.Ascending)
{
radGridView1.Columns["priority"].Sort(RadSortOrder.Descending, false);
}
else if (radGridView1.Columns["priority"].SortOrder == RadSortOrder.Descending)
{
radGridView1.Columns["priority"].Sort(RadSortOrder.Ascending, false);
}
else
{
radGridView1.Columns["priority"].Sort(RadSortOrder.Ascending, false);
}
}
}
}
But it doesn't work. When I hit "va" column header, it sorts the "va" column and not the "priority" column. But in debugging mode I can see it goes through this code. Can anyone please tell me why it's not sorting "priority" column?
Thank you
Regards,
Danilo
I'm trying to sort a RadGridView by clicking a header cell. The name of the column which should be sorted is "priority" and it's type is double. I have some other column which has different values. All these columns together build a "priority number" like 1.0, 2.0, 2.1 etc. And this "priority number" is in column called "priority". And now I'm trying to sort the priority column. It shouldn't matter which column header i click, it just have to sort the priority column. I tried this code:
private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (e.RowIndex == -1)
{
if (e.Column.Name == "va")
{
if (radGridView1.Columns["priority"].SortOrder == RadSortOrder.Ascending)
{
radGridView1.Columns["priority"].Sort(RadSortOrder.Descending, false);
}
else if (radGridView1.Columns["priority"].SortOrder == RadSortOrder.Descending)
{
radGridView1.Columns["priority"].Sort(RadSortOrder.Ascending, false);
}
else
{
radGridView1.Columns["priority"].Sort(RadSortOrder.Ascending, false);
}
}
}
}
But it doesn't work. When I hit "va" column header, it sorts the "va" column and not the "priority" column. But in debugging mode I can see it goes through this code. Can anyone please tell me why it's not sorting "priority" column?
Thank you
Regards,
Danilo