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

PopulateValues - to expand the grid automatocally

I''ve written the following method: protected void PasteData(GridRangeInfo rangeInfo, object data) { // expand the grid if necessary (to fit the data!) if (rangeInfo.Bottom > this.RowCount) this.Rows.InsertRange(this.RowCount+1, rangeInfo.Bottom - this.RowCount); if (rangeInfo.Right> this.ColCount) this.Cols.InsertRange(this.ColCount+1, rangeInfo.Right - this.ColCount); this.Model.PopulateValues(rangeInfo, data); } When I had a UserControl with a GridControl as a member then this worked. Now that my UserControl inherits directly from GridControl an exception is generated (Index out of Range) in the PopulateValues call.

5 Replies

AD Administrator Syncfusion Team March 22, 2005 06:46 PM UTC

Can you post a call stack showing the exception? You might check whether this.RowCount/ColCount and base.RowCount/ColCount are different values? One comment is that in a GridControl, it should automatically add rows/columns during a paste if they are needed (unless you have set the grid.Model.CutPaste.ClipboardFlags to include the GridDragDropFlags.NoAppendRows and GridDragDropFlags.NoAppendCols flags).


CV Charles Vereker March 23, 2005 08:24 AM UTC

>Can you post a call stack showing the exception? "An unhandled exception of type ''System.ArgumentOutOfRangeException'' occurred in syncfusion.grid.windows.dll Additional information: Specified argument was out of the range of valid values." >You might check whether this.RowCount/ColCount and base.RowCount/ColCount are different values? They are different (i.e. pre-InsertRange) values. I tried setting them explictly but that did not work. >One comment is that in a GridControl, it should automatically add rows/columns during a paste if they are needed (unless you have set the grid.Model.CutPaste.ClipboardFlags to include the GridDragDropFlags.NoAppendRows and GridDragDropFlags.NoAppendCols flags). The name of my method is misleading. It should really be an override of PopulateValues. The data passed in is not the result of a cut and paste operation, but rather an array, or DataTable from elsewhere in my program.


AD Administrator Syncfusion Team March 23, 2005 08:49 AM UTC

Something else to try. Instead of calling this.Rows.InsertRange this.Cols.InsertRange try calling this.Model.Rows.InsertRange this.Model.Cols.InsertRange If you can upload a sample showing the problem (or email one to support@syncfusion.com mentionaing this thread in the subject line) we can try to debug it here.


CV Charles Vereker March 23, 2005 09:06 AM UTC

I still get an exception. I will email/ upload my code later this week. Thanks for the exceptionally quick reply!!


CV Charles Vereker March 23, 2005 04:38 PM UTC

In cleaning my code of other dependencies before uploading I took on board another suggestion/instruction of yours to do some things AFTER the GridControl had been added to it''s parent''s control. This fixed the problem (& others!!) Thank, Charlie

Loader.
Live Chat Icon For mobile
Up arrow icon