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.
Unfortunately, activation email could not send to your email. Please try again.

register cell model on related grid of a gridgrouping control

Thread ID:

Created:

Updated:

Platform:

Replies:

30093 Jun 10,2005 09:19 AM Jun 13,2005 08:11 AM Windows Forms 3
loading
Tags: Grouping
Albie
Asked On June 10, 2005 09:19 AM

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

Administrator [Syncfusion]
Replied On June 11, 2005 04: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";

Albie
Replied On June 13, 2005 04: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

Administrator [Syncfusion]
Replied On June 13, 2005 08: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?

CONFIRMATION

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.

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.

;