Category / Section
How to have a HTML control within the WinForms GridGroupingControl cell?
1 min read
Add custom control
To have a HTML control within the GridGroupingControl cell, you have to make use of the control called HtmlUIControl. By setting this control as a cell type of particular cell, you can have a HTML control within the Grid.
C#
string xhtml1; byte[] byteArray; MemoryStream stream; Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl htmluiControl1 = new Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl(); htmluiControl1.AutoScroll = true; htmluiControl1.LoadHTML(stream); //Sets the column cell type as the HTML control. GridColumnDescriptor column1 = this.gridGroupingControl1.TableDescriptor.GetColumnDescriptor("Column");//Specifies the Column name. column1.Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Control; column1.Appearance.AnyRecordFieldCell.Control = htmluiControl1; column1.Width = 300;
VB
Dim xhtml1 As String Dim byteArray() As Byte Dim stream As MemoryStream Dim htmluiControl1 As New Syncfusion.Windows.Forms.HTMLUI.HTMLUIControl() htmluiControl1.AutoScroll = True htmluiControl1.LoadHTML(stream) 'Sets the column cell type as the HTML control. Dim column1 As GridColumnDescriptor = Me.gridGroupingControl1.TableDescriptor.GetColumnDescriptor("Column") 'Specifies the Column name. column1.Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.Control column1.Appearance.AnyRecordFieldCell.Control = htmluiControl1 column1.Width = 300
The following image displays the HtmlUIControl cell type in the Grid Grouping control.