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

Changing RowCount of Grid at runtime

hi,

I am trying to increment / decrement the rows in a grid control at run time.

I do a something like the one belwo

((System.ComponentModel.ISupportInitialize)(this.categoryGrid)).BeginInit();
if(inc)
this.categoryGrid.RowCount += 1;
else
this.categoryGrid.RowCount -= 1;
((System.ComponentModel.ISupportInitialize)(this.categoryGrid)).EndInit();


The next time I call categoryGrid.refresh() the count goes back to the original value and my rows in the view also get lost ....How can i change the rowCount at run time and retain them . Someone please throw light on this.

-Shashank

1 Reply

AD Administrator Syncfusion Team June 25, 2007 09:05 AM UTC

Hi Shashank,

You can increase or decrease the rowcount using this code snippet:

grid.RowCount = grid.RowCount +1;//Increase
grid.RowCount = grid.RowCount -1;//Decrease


Here is a small sample:
http://websamples.syncfusion.com/samples/Grid.Windows/F62837/main.htm

The other comment is that it is much quicker to add all the rows or columns at one time, than it is to add then row or cols one at the time. So, if you want to add 500 rows, use code like
grid.RowCount = grid.RowCount + 500 instead of grid.RowCount += 1 five hundred times.

Kindly let us know if you need any further assistance.

Best Regards,
Jeba.


Loader.
Live Chat Icon For mobile
Up arrow icon