I am using a DataBoundGrid bound to Dataview with sorting other to default.
When I modify the sorting field in an
existing row or when I add a new row,
then the Grid according to DataView
Sorting moves the row to sorting
Is there any way to prevent this to happen .
The new sorting to take place after
I leave the Grid or if I explicitly
ADAdministrator Syncfusion Team February 25, 2004 12:34 PM UTC
There is not a simple way to do this as the GridDataBoundGrid just displays what is in the datasource, and dataviews automatically sort themselves when a change is made.
There are things you can try to do. One would be to cache all changes locally, and only commit the changes to the datasource when you want things sorted. To do this, you would have to handle SaveCellInfo, and cache the e.Style.CellValue to some local data cache, set e.handled = true, and call grid.Binder.CancelEdit to make sure the grid does not pass the change immediately onto the datasource. Then, you would have to handle grid.Model.QueryCellInfo and if the e.ColIndex and e.RowIndex point to a cache value, then you would set e.Style.CellValue to the cached value provide the correct value. Then you would have to add code to move your cached values to the datasource. One way you could do this is to set some flag that is checked in SaveCellInfo. Then loop through all the cached values and set them into the grid using indexers. Then in SaveCellInfo, if this flag is set, do not execute the caching code, but instead just do nothing and let the grid handle things as it normally would. It is not clear if you would run into any technical problems as you tried to work though this process.
STStefan TFebruary 25, 2004 06:43 PM UTC
I will try it when I will have time .
Also I will try another solution I found today from microsoft knowledge base.
To set as datasource a custom dataview,
- JoinedView . It has a property
AllowSort permitting to set Sort off.