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.
Unfortunately, activation email could not send to your email. Please try again.

Sorting a column having a dropdown list in a databound grid by display member

Thread ID:

Created:

Updated:

Platform:

Replies:

37221 Nov 17,2005 11:09 AM Nov 17,2005 03:22 PM Windows Forms 3
loading
Tags: Grouping
Sachin Bamel
Asked On November 17, 2005 11:09 AM

I am using version 2.1.0.9 of syncfusion. I have a databound grid with one of the column having a dropdown. By default the column gets sorted by value member. I need to sort it by display member. To acheive the same, I have implemented IBindingList and overriden the Applysort & used custom sorting. Now the column gets sorted by display member as expected. But Whenever the underlying view gets refilled or changed the container holding the sorted index becomes invalid (for eg. Mine is a tabsheet application & when I go to some other page & come back the view gets refreshed & I get Indexoutof bound of exception. I do not have any way to track when the underlying view of the grid will get changed or refreshed & I have to resort the container which holds the sorted indices. If needed I will send the class I have written. I thank you in advance for the reply. Also similar query I have for the grouping grid.

Administrator [Syncfusion]
Replied On November 17, 2005 12:45 PM

In the case of a DataView, when the datasource is sorted, a ListChanged.Reset event is raised. Are you doing this in your implementation? If you can upload a sample project showing the problem, we can try to debug it here.

Sachin Bamel
Replied On November 17, 2005 02:35 PM

I am calling this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); Even the sorting is working as expected. The problem occurs when mModelTable.BeginLoadData(); mModelTable.Clear(); mDataAdapter.Fill( mModelTable ); After this the view gets changed & the container which holds the index of the data in the column becomes invalid so I need to resort this array again. Even I somehow took care of these situation. There are couple of other situations where indirectly view gets changed & since I am not able to track them, the container''s indexes gets invalid. I am just attaching the 2 files Referencedataproxy.cs where the IBindingList is implemented and Rowcomparer.cs where I have implemented IComparer interface. I hope you will get some clue out of it.

files1.zip

Administrator [Syncfusion]
Replied On November 17, 2005 03:22 PM

Without a running sample, and being able to debug the behavior it is difficult to be of much help. Just something to try. Before reloading your data, somehow clear the sort so mSortOrder = null; and mView.Sort = "".

CONFIRMATION

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.

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.

;