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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I reset the column order on a GridGontrol?

Thread ID:





106218 Dec 17,2012 02:22 PM UTC Jan 24,2013 05:10 AM UTC WPF 4
Tags: GridControl
Will Rogers
Asked On December 17, 2012 02:22 PM UTC

I've discovered the following methods for resetting the grouped columns, filters, and sorted columns, but I haven't found one for resetting the original column order. What's the easiest way to do this? I really don't want to persist the original grid state to disk.

DealGridControl.ShowFilters = false;

Thanks in advance,

Rajasekar G [Syncfusion]
Replied On December 26, 2012 10:45 AM UTC

Hi Will,


We have analyzed your requirement and we have achieve your requirement by using the following code snippet.


Code Snippet[C#]:

private void Order_Click(object sender, RoutedEventArgs e)


    foreach (KeyValuePair<int,string> it in Vcolorder)


        int fromindex = this.SyncGrid.VisibleColumns.IndexOf(this.SyncGrid.VisibleColumns[it.Value]);





We have prepared a sample based on this and it can be download from the following location.


Sample Location: GridDataControl_VisibleColumn.zip



·         Run the sample .

·         Re arrange the column by Column drag and drop.

·         Click the button Arrange order to rearrange the visiblecolumn


Please let us know if you have any questions.



Raja sekar.G

Will Rogers
Replied On January 4, 2013 02:59 PM UTC

Thank you. I will give this a try when I am next able to work on this.

Will Rogers
Replied On January 16, 2013 06:16 PM UTC

Thanks, that method worked but is sub-optimal from a user standpoint. It would be really nice if you just exposed a Reset() method on the GridDataControl that resets the sorting, grouping, ordering, and filtering. How do I go about formally requesting that feature?

If you don't mind a related follow up, I'm now having trouble resetting the Filters on the VisibleColumns. I'm trying to do this:

for (int i = 0; i < gridDataControl.VisibleColumns.Count; i++)
{                                                                      gridDataControl.VisibleColumns[i].Filters.Clear();

But at certain points in my app the VisibleColumns.TableModel is null and the operation blows up with a null ref exception during your call to ApplyFilter().

Any suggestions?

Rajasekar G [Syncfusion]
Replied On January 24, 2013 05:10 AM UTC

Hi Will, 

Sorry for the delay in getting back to you. 

Could you please create new incident for feature request through Direct Trac system and we will update the status of this through incident. 

Direct Trac Link : https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents 

And also could you please share the following details with us in the Direct Trac incident .That would be very helpful for us to further analysis to provide the solution for the issue “Null Exception occur while using VisibleColumns collection”    

·         Could you please share your simple sample to replicate the issue.

·         In which scenorio do you clear the filters from the VisibleColumn.


Please let us know If you have any questions.  


Raja sekar.G


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon