change or filter a list in the event QueryCellStyleInfo (WinForms)

I want to change the datasource of a GridListControl (which is in a column of a grouping grid) in the event QueryCellStyleInfo.
This is the code below in the event QueryCellStyleInfo :

e.TableCellIdentity.Table.Engine.SourceListSet[stat.Code].List = selectStatus.ToList();
e.TableCellIdentity.Table.TableDescriptor.Relations[0].Name = "Name";
e.TableCellIdentity.Table.TableDescriptor.Relations[0].MappingName = "Code";
e.TableCellIdentity.Table.TableDescriptor.Relations[0].ChildTableName = stat.Code;

This code doesn't work. I can't update my list in the event QueryCellStyleInfo. There's no items in my list. Why ??

Adrien Falconnet.

1 Reply

JJ Jisha Joy Syncfusion Team October 1, 2009 10:24 AM UTC

Hi,

Thank you for posting query to us.

Please see the following code that shows how to set datasource to the gridlist dropdown in GridGroupingControl in QueryCellStyleInfo event.

this.gridGroupingControl1.TableDescriptor.Columns["Col0"].Appearance.AnyRecordFieldCell.CellType = "GridListControl";

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell
|| e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.MappingName == "Col0")
{

e.Style.DataSource = GetTable1();
e.Style.DisplayMember = "ID";
e.Style.ValueMember = "Description";

}
}
}

Regards,
Jisha

Loader.
Up arrow icon