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

When does ClearCells fail

I have a situation in which the ClearCells method does not clear the cells I have asked it to, and it returns false. What causes ClearCells to return false? An additional question about ClearCells: when I have a grid with only two columns and about three rows, if I pass ClearCells the GridRangeInfo obtained from GridRanageInfo.Rows(1,3) say, it takes a noticable amount of time to clear the cells. Surely you''re not ignoring the ColCount of the Grid and actually clearing all the millions of cells in the row?

3 Replies

AD Administrator Syncfusion Team March 24, 2004 05:14 AM

If you are clearing styles, then ClearCells will fail when this call returns false: ChangeCells(expandedRange, GridStyleInfo.Empty, StyleModifyType.Remove); It tries to empty the styles in the cells in the expanded range. If you are not clearing styles, then ClearCells will fail when this call return false: style.ApplyFormattedText("", GridCellBaseTextInfo.ClearCells); So, exactly what kind of cells is the clearing failing on? Are they ReadOnly or are the cells something that a empty text or empty style would not be a proper value for? The code does call ExpandRange to convert any row range to a cell range before it does any looping. In the sample below, I don''t really see any significant difference in using cell ranges or row ranges. The one that is done first takes a little more time because of the JITing. Do you see a difference in the sample? If you own the source, the operable code is in Essential Suite\2.0.3.0\Grid\Src\Base\Model\GridModel.cs(5998). ForumClearCells_9258.zip


SJ Samuel Jack March 24, 2004 06:27 AM

In the one case the cells I was clearing had a CellValueType of DateTime. In the other, they were set to the type of one of my objects. They weren''t readonly. No, I don''t see a difference in the sample


AD Administrator Syncfusion Team March 24, 2004 07:34 AM

Is this a GridDataBoundGrid with the values coming from some DataTable? If so, do these DataColumns have AllowDBNull = true so they can be set empty? Check the output window to see if there are any exceptions being thrown. That might shed some light on why things are not being cleared. Seeing exceptions might also explain why some clearing is taking longer than other clearings.

Loader.
Live Chat Icon For mobile
Up arrow icon