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
close icon

Controls in Grid Cells

Hi
I have a class that is derived from a MaskedTextBox and would like a grid cell to be of this type. How do I do it.
Thanks.

3 Replies

AD Administrator Syncfusion Team February 8, 2007 05:41 PM UTC

Hi Ryan,

If you want to host this control in a single grid cell, then you can do this by setting the celltype of the cell to be a control and then set the control that you want the cell to be associated with. Below is the code.

this.gridControl1[2,2].CellType = "Control";
this.gridControl1[2,2].Control = youruserControl1;

If you want to have this control in several cells, then you will have to create a custom celltype deriving the control. It requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell.

Please refer the CustomCellTypes category sample in the browser samples for more details.
[instal drive:] \Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes

Best Regards,
Haneef


AD Administrator Syncfusion Team February 11, 2007 10:51 AM UTC

Hi Haneef.

Thanks for the answer, but I still have a problem.

I intend to display the data using a GridDataBoundGrid control. This, off course, requires me to work with columns rather than specific cells.
I already found out that the GridBoundColumn control has a CellType member, which I set to "Control", but I don't see how I set the GridBoundColumn to refer to MY control. MY control is an edit box derived from MaskedTextBox. I want all the cells in a specific column to be of the same time.
1. Can it be done with a GridDataBoundGrid ?
2. If not, can it be done with other grids ?



>Hi Ryan,

If you want to host this control in a single grid cell, then you can do this by setting the celltype of the cell to be a control and then set the control that you want the cell to be associated with. Below is the code.

this.gridControl1[2,2].CellType = "Control";
this.gridControl1[2,2].Control = youruserControl1;

If you want to have this control in several cells, then you will have to create a custom celltype deriving the control. It requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell.

Please refer the CustomCellTypes category sample in the browser samples for more details.
[instal drive:] \Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes

Best Regards,
Haneef


AD Administrator Syncfusion Team February 13, 2007 12:52 AM UTC

Hi Ryan,

Can it be done with a GridDataBoundGrid ?
>>>
Yes. You can set the StyleInfo.Control property in a GridBoundColumn. Here is a code snippet.

this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.CellType = "Control";
this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.Control = yourcontrol;

Sample : GDBGControlCell.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon