Getting Started - Virtual Grid Tutorial

Virtual grids allow you to display large data sources very quickly.

This sample illustrates binding a grid to an external data source so that no data actually resides in the grid. The data is provided to the grid on-demand through an event that allows you to furnish requested data in the handler.

Virtual Grid screenshot

Features

They provide the basic information about the number of rows and columns and the values of data.

            void GridQueryCellInfo(object sender, GridQueryCellInfoEventArgs e) 
            {
                if (e.RowIndex > 0 && e.ColIndex > 0)
                {
                    e.Style.CellValue = this._extData[e.RowIndex - 1, e.ColIndex - 1];
                    e.Handled = true;
                }
            }  
            if(this._extData[e.RowIndex - 1, e.ColIndex - 1] % 3 == 0)
                e.Style.BackColor = Color.LightPink;
                e.Handled = true;  
            void GridSaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
            {
            this._extData[e.RowIndex - 1, e.ColIndex - 1] =   int.Parse(e.Style.CellValue.ToString());
                e.Handled = true;
            }  

The reason to query with -1 is to denote -1 for colstyles and rowstyles. When the table style is requested, both the e.RowIndex and e.ColIndex will be -1. Therefore, a condition check, if (e.RowIndex > 0 && e.ColIndex > 0), is required in these handlers.

Odd rows are covered from columns 1 to 3 and odd-even row pairs are covered in column 6.