custom cell control that places a DropDown Form/UserControl in a cell not working in the GGC, but works in the GridControl

I saw an example for the gridcontrol in with a custom user control and a windows form were used as drop down popup for a cell.

I tried to port this over to the ggc, which I think should be straight forward by replacing

//2) Register your custom cell type
this.gridControl1.CellModels.Add("DropDownUserControl", new DropDownUserCellModel(this.gridControl1.Model, new DropDownUser()));


//3) Set the style.CellType for the cells
this.gridControl1[6, 2].CellType = "DropDownUserControl";

with...

//2) Register your custom cell type
this.gridGroupingControl2.TableControl.Model.CellModels.Add("DropDownUserControl", new DropDownUserCellModel(this.gridGroupingControl2.TableControl.Model, new DropDownUser()));


this.gridGroupingControl2.TableDescriptor.Columns["DaysOfWeek"].Appearance.AnyRecordFieldCell.CellType = "DropDownUserControl";


... but this is not working. Does the grouping grid supports this?

5 Replies

AD Administrator Syncfusion Team December 20, 2006 06:34 PM UTC

Hi James,

Please try the following code snippet and let us know if you need any further assistance.

>>>>>>>>>>
this.gridGroupingControl2.TableModel.CellModels.Add("DropDownUserControl", new DropDownUserCellModel(this.gridGroupingControl2.TableModel, new DropDownUser()));
this.gridGroupingControl2.TableDescriptor.Columns["DaysOfWeek"].Appearance.AnyRecordFieldCell.CellType = "DropDownUserControl";
>>>>>>>>>>

Thank you for being patience.

Best regards,
Madhan



JB James Blibo December 21, 2006 12:32 AM UTC

sorry... did not work!


JB James Blibo December 21, 2006 05:47 AM UTC

my bad... i saw my mistake... i've got it working...


JB James Blibo December 28, 2006 05:12 AM UTC



In the DropDownUserCell class, the value is being saved to the underlying datasource in this override...

protected override bool OnSaveChanges()
{
string s = this.ddUser.GetValuesToString();

this.Grid.Model[this.RowIndex, this.ColIndex].Text = s;
return true;
}

I am trying to write to another column in the row, how can I do this by column name instead of row and col index.

I want to do something like

this.Grid.Model["colname"].Text = s;


AD Administrator Syncfusion Team January 3, 2007 08:22 PM UTC

Hi James,

Please try the following code snippet and let us know if you need any further assistance or demo sample on this issue.

>>>>>>>>Code Snippet<<<<<<<<<<
protected override bool OnSaveChanges()
{
string s = this.ddUser.GetValuesToString();
int val = this.Grid.Model.NameToColIndex("Col2");
this.Grid.Model[this.RowIndex, val].Text = s;
return true;
}
>>>>>>>>>>>>>><<<<<<<<<<<<<<<<

Have a nice day.

Best regards,
Madhan

Loader.
Up arrow icon