Hi,
I need to know whether we can eliminate the last row from sorting while the column header is clicked using mouse.
Regards,
Ceaser
Ceaser,
You could try cancelling the BeforeSortChange event of the grid, checking to see if the last column is contained in the SortedColumns collection passed into the event handler.
-Matt
I just noticed that I misread your question in that I thought you wanted to prevent one of the columns from being sorted when you click on its header. What do you mean by "eliminate the last row from sorting"?
yes, you are right FixedRows is better.
I'm sorry, I'm having trouble understanding what you are asking. Is this working or not?
I think FixedRows is probably the easiest way to acheive what you want, but since I'm not really sure exactly what you want, it's hard to say. :)
Mike I have written like this
The first cell of every rows will be filled except the last row.
private void UltraGrid_AfterSortChange(object sender, BandEventArgs e)
{
_ultraGrid.Rows.Move(row, _ultraGrid.Rows.Count - 1);
break;
}
working: The first cell of last row is when filled another row automatically created, so by this time the new row will be last row.
Also can you suggest for this functionality FixedRows rows is better option.
If I understand correctly, you want to sort the column, but ignore the last row and leave it at the bottom, regardless of the sort order of the rest of the rows.
There are two ways you might acheive this:
1) You can use FixedRows and fix the row at the bottom of the grid. This will prevent it from sorting or scrolling so it will always be in view.
2) You could write a SortComparer for the column which always sorts the row to the bottom. This is a bit tricky and you would have to change the behavior of the IComparer based on the sort order of the grid column.
EDIT:
3) I just thought of a third option. You could wait until after the sorting is complete and then use the grid.Rows.Move method to move the row to the end. This would also be a bit tricky, though, because I think the sorting is done asynchronously.