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. Image for the cookie policy date

register cell model on related grid of a gridgrouping control

Hi, i''m having trouble registring a custom cell model to a related grid in the grid grouping control. I use the following code to register the model: GridTableControl tableControl = gridGroupingControl1.TableControl; GridModel model = tableControl.Model.Model; GridCellModelCollection cellModelCollection = model.CellModels; string modelName = "GenericCellModel"; if(!cellModelCollection.ContainsKey(modelName)) {cellModelCollection.Add(modelName, new GenericCellModel(model));} During runtime the "CreateRenderer ( GridControlBase control)" method on the GenericCellRenderer is called twice, once with the GridTableControl, and the second time with the GridNestedTableControl. My problem is that the GridNestedTableControl only contain null values. I use the following code to bind the cell model to a column in the related grid: GridTableCellStyleInfo gsi = parameterRel.ChildTableDescriptor.Columns["Parameter Value"].Appearance.AnyRecordFieldCell; gsi.CellType = "GenericCellModel"; gsi.ShowButtons=GridShowButtons.ShowCurrentCell; gsi.HorizontalAlignment=GridHorizontalAlignment.Left; gsi.ExclusiveChoiceList=true; gsi.DropDownStyle=GridDropDownStyle.Exclusive; Where parameterRel is the GridRelationDescriptor between the parent and child table. I just can''t use the grid on the GenericCellRenderer because the GridNestedControl does not contain the grid controlbase info. (Either null or "") Do you have any ideas? Thanx Albie

3 Replies

AD Administrator Syncfusion Team June 11, 2005 03:31 AM

You should add your celltype to the grid.TableModel, not the grid.TableControl.Model, if you want to be able to use you celltype in any nested table. this.gridGroupingControl1.TableModel.CellModels.Add("MyCell", new MyCellModel(this.gridGroupingControl1.TableModel)); GridTableDescriptor td = this.gridGroupingControl1.TableDescriptor; GridRelationDescriptor rd = td.Relations["ParentToChild"]; rd.ChildTableDescriptor.Columns["Name"].Appearance.AnyRecordFieldCell.CellType = "MyCell";


AL Albie June 13, 2005 03:23 AM

>You should add your celltype to the grid.TableModel, not the grid.TableControl.Model, if you want to be able to use you celltype in any nested table. > >this.gridGroupingControl1.TableModel.CellModels.Add("MyCell", new MyCellModel(this.gridGroupingControl1.TableModel)); > >GridTableDescriptor td = this.gridGroupingControl1.TableDescriptor; >GridRelationDescriptor rd = td.Relations["ParentToChild"]; >rd.ChildTableDescriptor.Columns["Name"].Appearance.AnyRecordFieldCell.CellType = "MyCell"; > Thanx Clay I have implemented the cell model as you suggested, however I stil get the same phenomenon. (The GridControlBase is passed to the cell renderer a second time with null values.) The code I use to describe the parent-child relattion is as follows: parameterRel = new GridRelationDescriptor "ParameterRel"); parameterRel.MappingName = "ID"; parameterRel.ChildTableName = "MetaParameter"; parameterRel.RelationKind = RelationKind.RelatedMasterDetails; parameterRel.RelationKeys.Add("ID","Operation ID"); I then add the columns of the related grid manually, as follows: parameterRel.ChildTableDescriptor.Columns.Clear(); parameterRel.ChildTableDescriptor.Columns.Add("Parameter Name"); parameterRel.ChildTableDescriptor.Columns.Add("Source Type ID"); parameterRel.ChildTableDescriptor.Columns.Add("Paramter Chain ID"); parameterRel.ChildTableDescriptor.Columns.Add("Parameter Source ID"); parameterRel.ChildTableDescriptor.Columns.Add("Parameter ID"); parameterRel.ChildTableDescriptor.Columns.Add("Parameter Value"); parameterRel.ChildTableDescriptor.Columns.Add("Parameter Type"); Would this have any effect on the cell model? I set the CellType of the related grid after the columns have been added and the datasource has been set. Is there any other reason why this should not work? Thank you for your help!! Albie


AD Administrator Syncfusion Team June 13, 2005 07:11 AM

Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GGC_RedCell_4589ba41.zip It lets the gridgroupingcontrol just auto populate the relations defined via the ado.net dataset. Are you using dataset that may have these relations already defined?

Loader.
Live Chat Icon For mobile
Up arrow icon