My grid is attached to a bindingSource object. The underlying data has a default sort on these four fields: Date, Bank, SiteID, Deposit. I have maintained the stock behavior of letting a user click on a column to perform a sort on that column. However, I want to provide the capability for my user to reset the sort order back to the original default (using the below button click).
If I click on a column to sort and then click button2 it appears to work the first time but it does not work on subsequent iterations. The column sort icon (triangle) goes away but the grid data does not reflect the underlying sort order within the button click - the data stays in the same sort order of last column sorted. IOWs, it appears that it becomes disassociated with the underlying currency manager.
Also, just as a test, I plopped a regular DataGridView right beside the UltraGrid and it appears to work perfectly when sorting the column and then the button. In fact, when I interact with the DataGridView it somehow resets the UltraGrid and it starts displaying the data properly.
Thanks
private void button2_Click(object sender, EventArgs
e)
{
grdStoreDeposits.DisplayLayout.Bands[0].SortedColumns.Clear();
storeDepositsBindingSource.Sort =
" Date,Bank, SiteID, Deposit"
;
grdStoreDeposits.DisplayLayout.Bands[0].SortedColumns.RefreshSort(
false
);
grdStoreDeposits.SyncWithCurrencyManager =
true
Hi,
I tried your code and it does not work for me even the first time. The grid never reverts to the original order.
However, this works every time:
this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear(); this.ultraGrid1.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.ReloadData);
That's what I needed...I have some other grids that were simply connected to datatables and they were not working correctly either.
Thanks Mike.