Articles in this section
Category / Section

How to set the RecordPreviewCell in WinForms GridGroupingControl?

3 mins read

RecordPreviewCell

By default, ShowRecordPreviewRow indicates whether the nested table has preview row or not. The Celltype of the RecordPreviewCell can be changed in the QueryCellStyleInfo event.

Solution:

To set a particular Record Preview Row as the HTMLUI cell type, you can use Record class to identify where to assign the HTMLUI control. By using this class, you can get the Record ID. According to this ID, you can assign the CellType to a particular Preview Row. The following code displays the same by using WinForms GridGroupingControl

.

C#

//QuerCellStyleInfo Event hooked.
this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(grid_QueryCellStyleInfo);
void grid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
  rec = e.TableCellIdentity.DisplayElement.GetRecord();
  //Specifies the needed Row.
  if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordPreviewCell) 
   {
     e.Style.BackColor = Color.AliceBlue;
     if (rec.Id == 3)
      {
        if (isrecordpreview)
         {
           //Celltype changed.
           e.Style.CellType = GridCellTypeName.Control;
           //HTMLUI control added.
           e.Style.Control = htmluiControl1;
         }
        else
         {
           //Intially RecordPreviewCell is displayed with this text.
           e.Style.Text = "Default RecordPreviewCell";
         }
      }
   }      
}

VB

'Inside Constructor.
'QuerCellStyleInfo Event hooked.
AddHandler gridGroupingControl1.QueryCellStyleInfo, AddressOf grid_QueryCellStyleInfo
Private Sub grid_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
 rec = e.TableCellIdentity.DisplayElement.GetRecord()
If e.TableCellIdentity.TableCellType = GridTableCellType.RecordPreviewCell Then
  e.Style.BackColor = Color.AliceBlue
If rec.Id = 3 Then
   If isrecordpreview Then
    'Celltype changed.
    e.Style.CellType = GridCellTypeName.Control
    'HTMLUI control added.
    e.Style.Control = htmluiControl1
   Else
    'Intially RecordPreviewCell is displayed with this text.
    e.Style.Text = "Default RecordPreviewCell"
   End If
  End If
 End If
End Sub

The following screenshots display the RecordPreviewCell type as a HTMLUI control:

  

Assign the cell type

Figure 1: Assign CellType

RecordPreviewCell type set as HTMLUI control

Figure 2: RecordPreviewCell type set as HTMLUI control

Conclusion

I hope you enjoyed learning about how to set the RecordPreviewCell type as a control in WinForms GridGroupingControl.

You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations. You can also explore our
WinForms GridGroupingControl documentation
 to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied