ClearCells ?
Is there any way faster to clear a grid then using
grd1.ClearCells(GridRangeInfo.Table, False)
I have 4 grids on one form. When I click a button that clears all four it takes about 8 seconds. I have a sample attached. If you click the clear button and then wait you will see how long it takes. Is this normal or am I doing something wrong? If I set visible=false on all the grids it seems to maybe cut off a second. Any ideas or is this just normal?
Also when trying to view code sometimes on this form with 4 grids it seems to be way slower bringing up the code then other forms with one grid. Is this because of all the styleinfo I see in the windows generated code?
Thanks in advance.
MultipleGridsShowingProb1.zip
grd1.ClearCells(GridRangeInfo.Table, False)
I have 4 grids on one form. When I click a button that clears all four it takes about 8 seconds. I have a sample attached. If you click the clear button and then wait you will see how long it takes. Is this normal or am I doing something wrong? If I set visible=false on all the grids it seems to maybe cut off a second. Any ideas or is this just normal?
Also when trying to view code sometimes on this form with 4 grids it seems to be way slower bringing up the code then other forms with one grid. Is this because of all the styleinfo I see in the windows generated code?
Thanks in advance.
MultipleGridsShowingProb1.zip
SIGN IN To post a reply.
3 Replies
RA
Rajagopal
Syncfusion Team
September 6, 2007 02:21 AM UTC
Hi Philip,
The grid.ClearCells() method is used to clear the contents and leave the rows. When you have more number of cells to be cleared, this time delay is likely to occur. The other way of achieving this is by resetting the rowcount for the grid. Please try the below code in your sample.
Private Sub ResetGrid(ByVal grid As GridControl)
grid.BeginUpdate()
Dim c As Integer = grid.RowCount
grid.RowCount = 0
grid.RowCount = c
grid.EndUpdate(True)
End Sub
// button_Click event handler
ResetGrid(gridControl1)
ResetGrid(gridControl2)
ResetGrid(gridControl3)
ResetGrid(gridControl4)
Let me know if this helps.
Regards,
Rajagopal
The grid.ClearCells() method is used to clear the contents and leave the rows. When you have more number of cells to be cleared, this time delay is likely to occur. The other way of achieving this is by resetting the rowcount for the grid. Please try the below code in your sample.
Private Sub ResetGrid(ByVal grid As GridControl)
grid.BeginUpdate()
Dim c As Integer = grid.RowCount
grid.RowCount = 0
grid.RowCount = c
grid.EndUpdate(True)
End Sub
// button_Click event handler
ResetGrid(gridControl1)
ResetGrid(gridControl2)
ResetGrid(gridControl3)
ResetGrid(gridControl4)
Let me know if this helps.
Regards,
Rajagopal
PB
Philip Bishop
September 6, 2007 01:15 PM UTC
Ok that does clear the grids in a second or less but it loses all my cell info I set up in the designer such as currency cell type. It loses it all. Is there a way to do that and not lose all of that?
RA
Rajagopal
Syncfusion Team
September 6, 2007 08:23 PM UTC
Hi Philip,
To retain the styleinfo settings associated with each cell, you can serialize the grid without the cellvalue to an xml file and load the grid later from the xml file. In general, when you serialize the grid the CellValue will also get serialized as it is a part of GridStyleInfo object. We can avoid this getting serialized by subscribing to the GridStyleInfoStore.CellValueProperty.WriteXml event and ignore writing out the cell value there.
Please refer the below sample for more information
http://www.syncfusion.com/Support/user/uploads/GC_ResetGrid_1e54d860.zip
Let me know if this helps.
Regards,
Rajagopal
To retain the styleinfo settings associated with each cell, you can serialize the grid without the cellvalue to an xml file and load the grid later from the xml file. In general, when you serialize the grid the CellValue will also get serialized as it is a part of GridStyleInfo object. We can avoid this getting serialized by subscribing to the GridStyleInfoStore.CellValueProperty.WriteXml event and ignore writing out the cell value there.
Please refer the below sample for more information
http://www.syncfusion.com/Support/user/uploads/GC_ResetGrid_1e54d860.zip
Let me know if this helps.
Regards,
Rajagopal
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
PB Philip Bishop
- Sep 5, 2007 07:44 PM UTC
- Sep 6, 2007 08:23 PM UTC