In terms of processing speed, what is the best method for displaying tabular data from a database in a Windows forms C# app? We generally use data grids (Infragistics WinGrid), but have an instance where run-time performance MUST be optimal – coding complexity and other things are less important. Here are some paticulars:
1. Data is stored in SQL Server.
2. Data is read-only.
3. The container/control must allow for mouse-click event handling on a row or cell basis (based on row or cell content).
4. The container/control must allow for contents to be displayed in different font colors and weight (bold).
5. Volume of data (number of rows) will generally be under 15,000.
6. Data must be sortable based on on predefined criteria – not by clicking on column headers (in fact, there are no column headers).
We have considered using data grid, embedded HTML or use of a third party control. Any input would be helpful, including links to performance tests.
There is a DataGridView.VirtualMode
in DataGridView which can be used to pass only the displayed cells to the DataGridView. In that case, you are not binding to data, but rather handling the paint event of each cell individually.
We used it for large tables, with many rows/columns, and you really get your table drawn instantly. The downside is that you lose the data-binding benefits, and have to implement some sort of custom caching: