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

sorting on foreign key table by using ComboBox

Thread ID:

Created:

Updated:

Platform:

Replies:

56328 Feb 13,2007 06:29 PM UTC Apr 6,2007 12:36 AM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 13, 2007 06:29 PM UTC

Hello:

In attempting to add a foreign key Description column to a GDBG v3.2.1.0 (from a strongly typed DataSet), I found this existing posting which helped me add the column.

http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=1514

So I have successfully added a column displaying the CategoryDescription (from another table) instead of the CategoryID from the bound table for this grid. Great.

My problem is sorting. When I click the column header to sort on that column, it is sorting on the MappingName which is the CategoryID for the bound table. Is there any way I can click on the column and have it sort on the displayed information? (which is the foreign CategoryDescription)

Any help would be appreciated. Thanks.

Administrator [Syncfusion]
Replied On February 13, 2007 07:47 PM UTC

Hi Todd,

Please refer to the DataBoundSortByDisplayMember sample in the Syncfusion browser samples shipped with the product.

C:\Program Files\Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\DataBound\DataBoundSortByDisplayMember

The aboove sample has a solution for sorting a column by its display member instead of the value member of the column.

Thanks for using Syncfusion Products.

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 14, 2007 04:25 PM UTC

Hi Haneef,
Thanks for pointing me to that sample. My version 3 installation of the grid does have that sample. I've been trying to get this to work, but it's not working for me yet.

To be specific, I'm getting an exception inside gridDataBoundGrid1_CellClick():

If dv.Sort = sortName Then
dv.Sort = sortName + " DESC"
sortDir = ListSortDirection.Descending
Else
dv.Sort = sortName <-- Exception here
grid.Model(0, e.ColIndex).Tag = sortDir

The exception I'm getting at the line is
"Cannot find column 'CategoryName'."
(to use your example)

So it is to the point where it's recognizing that column as column.MappingName = "CategoryID", so that's good. It's just failing when trying to use that 'CategoryName'.

I have set up the GridBoundColumns exactly as you have in the example, so I'm not quite sure what the problem is yet. I have no doubt the solution works, since I have your example solution working fine. 8) But if you had any thoughts on an easy place I might be missing something, I'd appreciate it.

Thanks.

Administrator [Syncfusion]
Replied On February 16, 2007 11:28 PM UTC

I figured out what my problem was. I have this working just fine, for what the sample code intends. Thanks a ton.

My problem is this, and looks like a detail I should have mentioned up front. The GDBG that I'm using, is used not only for show, but for edit/update purposes also. When I perform a dataAdapterName.Update() on the adapter tied to this grid with this custom sorting code, I get this exception:

"Dynamic SQL generation is not supported against multiple base tables."

So my question is this I guess: Will this example only work on a grid that is meant for display only, since it involves joining of a couple tables to get the foreign key Description column?

Thanks.

Administrator [Syncfusion]
Replied On February 19, 2007 07:46 PM UTC

Just checking in if my last question made sense to anyone.

Thanks.

Mark Atkinson
Replied On April 6, 2007 12:36 AM UTC

It looks like I'm a few months too late, hopefully you've found a solution.
Anyways, I se your problem and I'm dealing with the same issue. I can't do any kind of inner join to prepare the table and add the description columns in.

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.

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

;