Grid Population Demo

This sample illustrates three ways of Essential Grid population. The first technique loops through the cells and uses an indexer on the GridControl to set values. The second technique uses the PopulateValues() method to optimally place data from a data source into a grid range. The last technique uses Essential Grid in a virtual manner.

Grid Population Sample screenshot

Features

            for (int i = 0; i < this.numArrayRows; ++i)
            for(int j = 0; j < this.numArrayCols; ++j)
            this.gridControl1[i + 1, j + 1].CellValue = this.intArray[i,j];  
            gridControl1.Model.PopulateValues(GridRangeInfo.Cells(top, left, bottom, right), this.intArray);  

Three handlers are to be used:

            this.gridControl1.QueryCellInfo += new GridQueryCellInfoEventHandler(QueryCellInfoHandler);    
            this.gridControl1.QueryColCount += new GridRowColCountEventHandler(GridQueryColCount);                
            this.gridControl1.QueryRowCount += new GridRowColCountEventHandler(GridQueryRowCount);  

When you run this sample, you can specify the size of the grid that is to be populated, and then you can try all three methods to compare their performance. However, be aware that the .NET Framework JIT will make the first population a little slower because of the one-time jitting of the code.

This sample also uses the OperationFeedback class to provide a progress bar in the first population technique to allow you to potentially cancel a long operation.