Cell Type Demo illustrates the usage of different controls as celltypes in grid cells. You will learn how to place push buttons, radio butttons, check boxes. You can easily use a push-button cell next to a check box or a combo box. You can even place special controls in the row headers.
Essential Grid uses a control-sharing architecture. While a combo box may appear in many different cells (even with different drop-list content), there is usually only a single combo box that is moved around and populated as needed. This architecture allows Essential Grid to have many different controls without the overhead of creating multiple controls of the same type. You can even create your own custom control types.
Given below is an image of the sample.
Features:
PushButtons
gridControl1[rowIndex,colIndex].CellType = "PushButton";
gridControl1[rowIndex,colIndex].Description = "PushButton1";
CheckBoxes
gridControl1.TableStyle.CheckBoxOptions = new GridCheckBoxCellInfo("True", "False", "", false); gridControl1[rowIndex,colIndex].CellValue = false; gridControl1[rowIndex,colIndex].Description = "Click Me"; gridControl1[rowIndex,colIndex].CellType = "CheckBox"; gridControl1[rowIndex,colIndex].TriState = false;
RadioButtons
This cell type enables multiple radio buttons in a cell. Their behavior is grouped.
this.gridControl1[2, 2].CellType = "RadioButton";
The number of radio buttons needed is set to an instance of the string collection and added using the ChoiceList property of a particular cell as follows.
sc = new StringCollection(); sc.AddRange(new String[]{"button 0","button 1/disabled","button 2","button 3"}); this.gridControl1[2, 2].ChoiceList = sc;
To disable the radio button, append "/disabled" to the text of the radiobutton as shown in the above code.
Set the cell value of the radio button cell to the index of a string collection to enable a particular button as selected.