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

GridDataBoundGrid Tree Grid Sorting Problem.

I am working working on a GDBG that has Hierarchical View (Tree view) and it is bound to 2 different views. I switch between views on the basis of an event. now when I sort GDBG using SortBehaviour = SingleClick. The whole grid collapses first and then start to sort. Is there anyway to sort a Grid without affecting its current state??

1 Reply

AD Administrator Syncfusion Team July 6, 2004 05:04 AM UTC

There is no property setting that allows this to happen. In the case of sorting, the datasource fires an IBindingList.ListChanged event with a ListChanged.Reset setting. This causes the nodes to reset. To handle this, you can save teh state before sorting, and reset it after sorting. One problem is that the reset also cancels any grid.BeginUpdate which then shows the nodes changing which is not good. One way to handle this is use a Win32 API directly freeze the painting instead of using grid.BeginUpdate. Here is a sample that works around this problem. It adds a new property to a derived grid that adds a second way to freeze the screen painting through a Win32 API call. This techique is discussed in one of our Windows Forms FAQ, http://www.syncfusion.com/faq/winforms/search/637.asp

Live Chat Icon For mobile
Up arrow icon