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

Which Grid to Use?

We have a Windows Form project that requires a databound grid with multi-column sorting, many excel-like features, formula cells, undo/redo, individual cell attributes such as colors, etc. What is a better choice: GroupGrid or GridDataBoundGrid? Why? Also, in a quick test of the GridDataBoundGrid, we found that using PrepareViewStyleInfo event handler to color a few cells caused a performance hit with our very large datasets. Is there a better way to do this without incurring a performance hit? Thanks, Bob

7 Replies

AD Administrator Syncfusion Team May 22, 2005 10:17 PM UTC

>>many excel-like features, formula cells, undo/redo, individual cell attributes such as colors, etc. If you want cell specific properties and formulas like =A1+B4*(C2-D4), then the GridControl is only grid that easily handles these requirements. How many rows and columns will you be needing? If it is limited number of records (say under a few hundred), one solution would be use a GridControl, explicitly setting the row and column count so it can store all the cell specific properties you need, and then handle QueryCellInfo to move the values from your DataTable to the e.Style.CellValue, and handle SaveCellInfo to move the values from e.Style.CellValue to your DataTable. If you have too much data to explicitly set the RowCount and ColCount in a GridControl, then you could try using a GridDataBoundGrid, handling grid.Model.QueryCellInfo and grid.Model.SaveCellInfo to handle the cell specific properties you need. Here is a sample showing one way to do this. It uses a hadtable and primary key/field name from your datasource to track properties you want to set on individual cells. http://www.syncfusion.com/Support/user/uploads/GDBG_CellCache_e02edc21.zip If your formula requirement is not cell specific, but only requires column oriented formulas, then you could add Expression columns to your Datatable and use a GridDataBoundGrid without having to handle individual cells using FormulCell CellTypes. Or, you can using a GridGroupingControl with its support for Expression fields. ---- Exactly how are you determining the cells that need to be colored in PrepareViewStyleInfo. For example, it you are doing this based on the cellvalue (say cells below 50 are one color and the other cells are another), then this normally would not be noticeable. But if you are trying to do some complex calculation or db lookup, then you will see a hit. In this case, you should try to cache the long computations somehow, and turn this into a simple local lookup instead of a long operation.


AD Administrator Syncfusion Team May 25, 2005 04:29 PM UTC

Clay, Thanks for the reply. In your response you said: "If your formula requirement is not cell specific, but only requires column oriented formulas, then you could add Expression columns to your Datatable and use a GridDataBoundGrid without having to handle individual cells using FormulCell CellTypes." Can you provide an example of how to do this? Thanks, Bob >>>many excel-like features, formula cells, undo/redo, individual cell attributes such as colors, etc. > >If you want cell specific properties and formulas like =A1+B4*(C2-D4), then the GridControl is only grid that easily handles these requirements. > >How many rows and columns will you be needing? If it is limited number of records (say under a few hundred), one solution would be use a GridControl, explicitly setting the row and column count so it can store all the cell specific properties you need, and then handle QueryCellInfo to move the values from your DataTable to the e.Style.CellValue, and handle SaveCellInfo to move the values from e.Style.CellValue to your DataTable. > >If you have too much data to explicitly set the RowCount and ColCount in a GridControl, then you could try using a GridDataBoundGrid, handling grid.Model.QueryCellInfo and grid.Model.SaveCellInfo to handle the cell specific properties you need. Here is a sample showing one way to do this. It uses a hadtable and primary key/field name from your datasource to track properties you want to set on individual cells. > > >http://www.syncfusion.com/Support/user/uploads/GDBG_CellCache_e02edc21.zip > >If your formula requirement is not cell specific, but only requires column oriented formulas, then you could add Expression columns to your Datatable and use a GridDataBoundGrid without having to handle individual cells using FormulCell CellTypes. Or, you can using a GridGroupingControl with its support for Expression fields. > >---- >Exactly how are you determining the cells that need to be colored in PrepareViewStyleInfo. For example, it you are doing this based on the cellvalue (say cells below 50 are one color and the other cells are another), then this normally would not be noticeable. But if you are trying to do some complex calculation or db lookup, then you will see a hit. In this case, you should try to cache the long computations somehow, and turn this into a simple local lookup instead of a long operation. > >


AD Administrator Syncfusion Team May 25, 2005 05:18 PM UTC

It is strictly working with the DataTable for the most part. http://www.syncfusion.com/Support/user/uploads/GDBG_ExpressionCOlumn_4b79addf.zip


AD Administrator Syncfusion Team May 26, 2005 12:42 AM UTC

We are still trying to decide on which Grid to use. Can someone help us with meet our needs? Here is some detailed information about our needs: Our typical project has about 3000-6000 rows and about 50 columns of data. The data is stored in an oracle database. Changes made within the grid are first stored in a temp file or oracle table and are only made to the actual Oracle table when the user selects Save Data. We need as many excel like features as possible such as multi-column sort, both cell and column formulas, undo/redo, insert/delete rows and columns, cut and paste, cell highlighting (or blinking) for out of spec values, multiple workbooks to contain datasets that are generated during user analysis. We would like the features to be as out-of-the-box as possible. 1) Is the Grid Control or GDBG the better choice? 2) If we use the Grid Control, what is the best way to poulate the grid from an Oracle database? How about updating the Oracle database with changes? Will this approach perform much slower than the GDBG??? Thanks, Bob >It is strictly working with the DataTable for the most part. > >http://www.syncfusion.com/Support/user/uploads/GDBG_ExpressionCOlumn_4b79addf.zip >


AD Administrator Syncfusion Team May 26, 2005 01:25 AM UTC

Do you need all this functionality in a single grid? >>both cell and column formulas What are you storing in your oracle database? I assume you storing formulas in the database, correct? If you are storing computed numbers there, what holds the formulas? If you have a cell formula in A10 like =Sum(A1:A9), what do you expect to happen when you sort a column? On my modest laptop, I can move 6000x50 cells from a DataTable and put them in a GridControl in less than 3 seconds. Using a GridControl that actually holds the data would allow the cell oriented work to be much easier to do. Putting the same 6000x50 DataTable into a GridDataBoundGrid takes about .5 seconds.


AD Administrator Syncfusion Team May 26, 2005 04:06 AM UTC

Could you please post an example on how to read a DataTable into the GridControl. Based uppon your numbers we will go with the GridControl. If our typical DataTable loads in 3 seconds we will go with the gridcontrol because managing cell properties seems easier. If the process takes maybe 30 seconds or more we would look to change to the GDBG. We plan on having both cell and column formulas available in the same grid. We are storing the computed numbers. We are considering storing column calcs in our existing project properties table. This table contains info about the analysis project such as creation date, version history, etc. If the cell formulas present a challenge with sort order, etc. We are still considering whether we will support cell formulas. BTW, our current version of software uses a competitor''s grid but we recently switched to the Essential product line because of your excellent feature base. Thanks again, Bob >Do you need all this functionality in a single grid? > >>>both cell and column formulas > >What are you storing in your oracle database? I assume you storing formulas in the database, correct? If you are storing computed numbers there, what holds the formulas? > >If you have a cell formula in A10 like =Sum(A1:A9), what do you expect to happen when you sort a column? > >On my modest laptop, I can move 6000x50 cells from a DataTable and put them in a GridControl in less than 3 seconds. Using a GridControl that actually holds the data would allow the cell oriented work to be much easier to do. > >Putting the same 6000x50 DataTable into a GridDataBoundGrid takes about .5 seconds. >


AD Administrator Syncfusion Team May 26, 2005 08:13 AM UTC

Here is the sample. http://www.syncfusion.com/Support/user/uploads/GC_CheckBox_f9d6149c.zip It has both a GridDataBoundGrid and a GridControl in it. The time is only measured around the code that moves the existing DataTable into the grid. It does not time how long it takes to create the 6000x50 DataTable (which is 2-3 seconds).

Loader.
Live Chat Icon For mobile
Up arrow icon