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

GridControl in Virtual Mode and the Concept of GridModel...

Hi, 
    I am looking at a sample application of a GridControl being used to bind to a hierarchical data and in doing so, I am unable to understand how come without assigning anything to datasource (or GridModel in this case) the data is rendered in the Grid. The GridSaveCellInfo and GridQueryCellInfo have been implemented and there is a sub classing as well. There are various CellModels associated with the Model. However, I do not see any actual data being assigned to the model and it is being constructed polymorphically. So I need to understand how GridControl data assignment is done via a tutorial. Thanks. 

1 Reply

AR Amal Raj U Syncfusion Team February 17, 2016 11:14 AM UTC

Hi Bhushan,

Thank you for contacting Syncfusion support.

In our GridControl, we can have options to populate the grid by QueryCellStyleInfo event and by giving cellvalue to gridcell by its index.

1)By QueryCellStyleInfo event:
In QueryCellStyleInfo event, the grid is populated by giving cellvalue through style of a particular cell.

Code Snippet:
//Cellvalue is given through style of particular cell
e.Style.CellValue = e.RowIndex.ToString() + "/" + e.ColIndex.ToString();

Refer to the following sample in the mentioned location for further reference.
Sample Location: \Syncfusion\EssentialStudio\13.4.0.53\Windows\Grid.Windows\Samples\Virtual Grid\Virtual Grid Demo\CS

2)By Index of a cell:
We can set cellvalue to an individual cell of grid by using property CellValue.

Code Snippet:
//To set cell value to particular cell.

this.gridControl1[rowIndex, colIndex].CellValue = "Value";

Refer to the sample for further reference.
Sample Link: CellGrid-331959580

Regards,
Amal Raj U.

Loader.
Up arrow icon