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

How to add a Grid inside a cell

Is it possible to add the cell type as grid.
I would like to display an information like this,like adding pincodes to the state. 
The issue is list of pincode entries is not known (for e.g) , we keep adding. 
I will not be able to add an entry for each pin.
So it would be great if you provide a means on how to use the grouping grid control , in which 
a the cell of a particular row can have editable grid / list.  What is the clean way to implement this.
Multiline text editing is not user friendly for pincodes column. So Please tell me how do we do this.

State Pincodes
         60001
TN    60002
         60003
         60004


        40001
AP   40002
        40003
      


1 Reply

AA Arulraj A Syncfusion Team March 13, 2019 12:20 PM UTC

Hi Pavan, 

Thanks for using Syncfusion product. 

You can achieve your desired behavior by adding the GridControl to the cell using QueryCellStyleInfo event and set the cell type as Control. Set unique GridControl objects for each cell and save/load them respectively. 

C# 
this.gridGroupingControl1.Table.DefaultRecordRowHeight = 120; 
this.gridGroupingControl1.TableDescriptor.Columns.Add("SampleData"); 
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Add("SampleData"); 
this.gridGroupingControl1.TableDescriptor.Columns[3].Width = 80; 
this.gridGroupingControl1.TableDescriptor.Columns["SampleData"].Appearance.AnyRecordFieldCell.CellType = "Control"; 
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 


private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if (e.Style.CellType == "Control" && e.Style.Control == null) //e.TableCellIdentity.ColIndex == 4 also works 
    { 
        var gc = GetGridControl(e.TableCellIdentity.RowIndex); 
        gc.CurrentCellEditingComplete += Gc_CurrentCellEditingComplete; 
        gc.CurrentCellKeyDown += Gc_CurrentCellKeyDown; 
        e.Style.Control = gc; 
    } 
} 

 

Arulraj A 


Loader.
Live Chat Icon For mobile
Up arrow icon