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.

ForeignKeyReference Filtering

Thread ID:

Created:

Updated:

Platform:

Replies:

40941 Feb 16,2006 07:22 PM Feb 20,2006 07:32 PM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 16, 2006 07:22 PM

Hi, I''m using GGC where the DataSource is set to a DataSet with several Tables and defined relations. One of the tables is used for a ForeignKeyReference relation. 1.How do I dynamically filter records, that are showing in dropdowngrid on per record basis? For instance: The lookup table contains values 1,2,3,4,5; If a parent record==2, then dropdown shoud display only 2,3,4,5 I''ve tried to handle TableControlCurrentCellShowingDropDown: private void oGrid_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e) { GridGroupingControl grid = (GridGroupingControl)sender; GridCurrentCell curCell=grid.TableControl.CurrentCell; if(curCell!=null) { Syncfusion.Windows.Forms.Grid.Grouping.GridTableDropDownListCellRenderer renderer = curCell.Renderer as Syncfusion.Windows.Forms.Grid.Grouping.GridTableDropDownListCellRenderer; if(renderer!=null) { GridTableDropDownListControlPart part=renderer.DropDownContainer.Controls[0] as GridTableDropDownListControlPart; GridGroupTypedListRecordsCollection coll = part.DataSource as GridGroupTypedListRecordsCollection; coll.TableDescriptor.ResetRecordFilters(); if (coll.TableDescriptor.RecordFilters.Count == 0) { coll.TableDescriptor.RecordFilters.Add("StatusId in (1,2,3,4)"); } } } } but it throws exceptions. 2. Is there a way to use the same type of relation and just show regular DropDown instead of DropDownGrid? Thank you.

Administrator [Syncfusion]
Replied On February 17, 2006 02:21 PM

Hi Ivan, check out the MultipleColumnForeignKeys example. You can have one column define a filter for the dropdown of a second column in a record. Stefan

Administrator [Syncfusion]
Replied On February 20, 2006 02:12 PM

Stefan, Thank you for the answer. Is there a way to achieve the same functionality without modifing the datasource and a single RelationKey. For instance - setting a RowFilter on child''s defaultview in some grid event? Thank you

Administrator [Syncfusion]
Replied On February 20, 2006 06:39 PM

I created a sample based on ForeignKeyReference that handles CurrentCellShowingDropDown. ForeignKeyReference_dynamicfilter.zip Stefan

Administrator [Syncfusion]
Replied On February 20, 2006 07:32 PM

Stefan, This works! I greatly appreciate your time.

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.

;