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.

Custom sorting in a DataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

2715 Feb 11,2003 03:19 AM Jul 1,2003 06:09 AM Windows Forms 2
loading
Tags: FAQ
Justin Spindler
Asked On February 11, 2003 03:19 AM

I have a DataGrid that has a custom TableStyle that contains several custom ColumnStyles. Of these ColumnStyles are a DataGridColumnStyle that hosts a ComboBox control. The underlying value of the column is the numeric ID but the DataGridComboBoxColumnStyle displays a textual description based on a Relation in a DataSet instead. This works wonderfully for displaying and editing the data. However, when you attempt to sort by that column since the underlying value is the numeric ID it sorts based on that value. I was wondering if it would be possible to intercept and implement a sort on my own that could walk the Relation and sort based on the textual description.

Andy
Replied On April 16, 2003 02:04 PM

I saw your post as I was looking for information about how to use the DataGridComboBoxColumStyle to put combos in the datagrid. I have had no luck getting this to work. Do you have any example code for how to use that combobox columstyle in the grid? Thanks in advance, Andy > I have a DataGrid that has a custom TableStyle that contains several custom ColumnStyles. Of these ColumnStyles are a DataGridColumnStyle that hosts a ComboBox control. The underlying value of the column is the numeric ID but the DataGridComboBoxColumnStyle displays a textual description based on a Relation in a DataSet instead. This works wonderfully for displaying and editing the data. > > However, when you attempt to sort by that column since the underlying value is the numeric ID it sorts based on that value. I was wondering if it would be possible to intercept and implement a sort on my own that could walk the Relation and sort based on the textual description.

Dominique
Replied On July 1, 2003 06:09 AM

Hello Justin. Did you get a solution for this problem ? I have the same problem and did not found any solution until now. Thanks for your answer. Dominique > I have a DataGrid that has a custom TableStyle that contains several custom ColumnStyles. Of these ColumnStyles are a DataGridColumnStyle that hosts a ComboBox control. The underlying value of the column is the numeric ID but the DataGridComboBoxColumnStyle displays a textual description based on a Relation in a DataSet instead. This works wonderfully for displaying and editing the data. > > However, when you attempt to sort by that column since the underlying value is the numeric ID it sorts based on that value. I was wondering if it would be possible to intercept and implement a sort on my own that could walk the Relation and sort based on the textual description.

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.

;