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

ForeignKeyReference Filtering

Thread ID:





40941 Feb 17,2006 12:22 AM UTC Feb 21,2006 12:32 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On February 17, 2006 12:22 AM UTC

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 07:21 PM UTC

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 07:12 PM UTC

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 11:39 PM UTC

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

Administrator [Syncfusion]
Replied On February 21, 2006 12:32 AM UTC

Stefan, This works! I greatly appreciate your time.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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