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.
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
February 20, 2006 11:39 PM UTC
I created a sample based on ForeignKeyReference that handles CurrentCellShowingDropDown.
ForeignKeyReference_dynamicfilter.zip
Stefan
AD
Administrator
Syncfusion Team
February 21, 2006 12:32 AM UTC
Stefan,
This works!
I greatly appreciate your time.