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
close icon

Erasing cells

Hi, I am using the virtual grid and I want to delete some rows. When I delete them from my model, they are also cleared from the table. That is all good. My issue is that the table is not resized. The number of rows stay the same even though it has clearly changed. Is there a call I can make to invalidate the row count. Right now I call something like this: gridControl1.BeginUpdate(); gridControl1.ResetGridBounds(); gridControl1.Selections.Clear(); gridControl1.Clear(false); gridControl1.Clear(true); gridControl1.Refresh(); gridControl1.EndUpdate(true); // hoping that some of it will do the trick :) I still use 1.5. I have tried 1.6 but that didn't help solving this problem.

4 Replies

AD Administrator Syncfusion Team August 22, 2003 05:39 AM UTC

A couple of comments. Your code appears to be clearing the contents of the selected rows. This does not actually remove the rows from the grid. If you want to actually remove the rows from the grid, you should use this.gridControl1.Rows.RemoveRange. But in a virtual grid, calling this.gridControl1.Rows.RemoveRange will not do anything to your data source as you have complete control there (the grid knows nothing about it when you are doing things virtually). What you would need to do, is to directly remove the rows from your external datasource somehow where you are now trying to use the grid to remove the rows. How you would do this depends upon the datasource.


JI Jimmy August 22, 2003 05:49 AM UTC

I am removing the data from my data model. They are also removed from the table. The problem is that it leaves empty rows in the bottom of the table. The code i pasted is called after removal of data from the data model. It doesn't work really. Was just posting it so you could see what I have been trying out.


AD Administrator Syncfusion Team August 22, 2003 06:04 AM UTC

By table, do you mean the grid or your exteranl datasource? If you mean the grid then how are you telling the grid how many rows are there in your datasource? Are you using the QueryRowCount event (and NEVER setting grid.,RowCount = xxxx)? If you are using QueryRowCount, then after removing the rows from your datasource, call grid.ResetVolatileData(). If you are explicitly setting grid.RowCount, then change this value to what it should be.


JI Jimmy August 22, 2003 06:21 AM UTC

I only mean to handle the GridQueryCount event. But if I remove my explicit setting to the RowCount property in the constructor, the grid has loads with a number of empty columns from the start. Setting the RowCount property again after erasing the cells solved my problem. Thanks for the *fast* replies!

Loader.
Live Chat Icon For mobile
Up arrow icon