We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Maintaining sort order on refresh.

Hi, I am using GridDataBoundGrid ver 2.1.0.9. I have a number of columns in my grid which are ''sortable''. Right now, if underlying DataSource (which is DataTable) is refreshed , grid is sorted by default column (which is the first column) instead of being sorted by column which was the ''sort'' column before refresh. If custom programming is required to achieve what i am trying to do, then how do i keep track of current column that is being used for sorting ? I guess, i can override SortbyColumn method and save colIndex argument .. is there is a more direct approach avaialable ? thanks

2 Replies

AD Administrator Syncfusion Team June 20, 2005 08:49 AM UTC

You can save the Sort property on teh DataView associated with the datasource before you refresh, an dthen reset this property after you refresh. CurrencyManager cm = this.grid.BindingContext[this.grid.DataSource, this.grid.Daatmember] as CurrencyManager; DataView dv = cm.List as DataView; string saveSort = dv.Sort; // do your refresh dv.Sort = saveSort;


AD Administrator Syncfusion Team June 20, 2005 06:15 PM UTC

thanks !!! this will help ... >You can save the Sort property on teh DataView associated with the datasource before you refresh, an dthen reset this property after you refresh. > >CurrencyManager cm = this.grid.BindingContext[this.grid.DataSource, this.grid.Daatmember] as CurrencyManager; >DataView dv = cm.List as DataView; >string saveSort = dv.Sort; > >// do your refresh > >dv.Sort = saveSort; > >

Loader.
Up arrow icon