Checking if a key already exists

How can i check if this cell type already exist before executing this statement?

gridControl1.CellModels.Add("TreeCell", new TreeCellModel(gridControl1.Model));

1 Reply

AD Administrator Syncfusion Team February 28, 2007 08:08 PM UTC

Hi Adnan,

You can use the ContainKey() method to determine the specfic CellType in GridCellModelCollection.

if( ! gridControl1.CellModels.ContainsKey("TreeCell"))
gridControl1.CellModels.Add("TreeCell", new TreeCellModel(gridControl1.Model));

Best regards,
Haneef

Loader.
Up arrow icon