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

PrepareViewStyleInfo Event

Hi, The grid is populated with data and the visible rows are 50. I am clicking on the 48 th row, then applying some grouping logic seperately not on grid now the visible row count is 30 and refreshing the grid that time PrepareViewStyleInfo event fires for the first time the rowindex is coming as 48 i am having some logic there to change the color of cetain rows but throwing up an "ndex was out of range" exception bcos it is trying to acces the element in 48 th row but the visible rows are only 30. My question here is does grid holds the last clicked row no before refreshing? Pls clarify the events function... Thanks Ravi

5 Replies

RA Ravichandran March 30, 2006 02:51 PM UTC

Hi Got want I am trying to say?? Thanks Ravi >Hi, > >The grid is populated with data and the visible rows are 50. I am clicking on the 48 th row, then applying some grouping logic seperately not on grid now the visible row count is 30 and refreshing the grid that time PrepareViewStyleInfo event fires for the first time the rowindex is coming as 48 i am having some logic there to change the color of cetain rows but throwing up an "ndex was out of range" exception bcos it is trying to acces the element in 48 th row but the visible rows are only 30. My question here is does grid holds the last clicked row no before refreshing? > >Pls clarify the events function... > >Thanks >Ravi


AD Administrator Syncfusion Team March 31, 2006 11:16 AM UTC

Hi Ravichandran, Sorry for the delayed response. Please provide some more information on the grouping logic that you are applying? We were not able to reproduce the issue here. Thanks for your patience. Best regards, Madhan Sample : PopulateValues_GGC


RA Ravichandran April 4, 2006 01:39 PM UTC

Hi Madhan, No problem. My problem is whenever I do Refresh() the QueryCellInfo and PrepareViewStyleInfo are fired with RowIndex of the last clicked row in the grid before I do refresh. Before doing Refresh() 1. I have expanded all the rows in the grid and clicked some of the bottom row say for example 45th row. 2. Then collapse all the rows.Now the QueryRowCount() events fires there I am setting the e.Count = my_document.VisibleRowCount; 3. So after collapsing the row count becomes 30. 4. Now if I call the Refresh() method of grid those two events are fired (QueryCellInfo and PrepareViewStyleInfo ) 5. Since the bound datasource is changed with 30 rows its throwing an Index outof range exception while trying to get the record in 45th row. These events are fired always with the rowindex previously displayed grid ( before refresh). My question is where it is keeping those rowindex value? Is there any way to avoid? Thanks Ravi. We have written some logic in those events to get the record of clicked row. >Hi Ravichandran, > >Sorry for the delayed response. Please provide some more information on the grouping logic that you are applying? We were not able to reproduce the issue here. > >Thanks for your patience. > >Best regards, >Madhan > >Sample : PopulateValues_GGC


AD Administrator Syncfusion Team April 5, 2006 12:00 PM UTC

Hi Ravi, Try setting the ResetVolatileData( ) before refreshing the grid and let us know if this helps. externalData.ExpandAll( ); gridControl1.ResetVolatileData(); gridControl1.Refresh( ); gridControl1.UpdateScrollBars(); this.gridControl1.Invalidate(); Kindly modify the attached sample to reproduce the issue here, if this does not help. Sample : VirtualTreeGrid.zip Thanks for the patience. Best regards, Madhan


AD Administrator Syncfusion Team April 5, 2006 01:58 PM UTC

Hi Madhan, I am calling the method ResetVolatileData() also eventhough getting the same error. But I have fixed the error by checking the following condition in PrepareViewStyleInfo event if ( e.RowIndex > 0 && this.CurrentCell.HasCurrentCellAt(e.RowIndex)) { // logic to get the record based on rowindex. } this returns false if the rowindex is out of range. thanks for your help Cheers Ravi. >Hi Ravi, > >Try setting the ResetVolatileData( ) before refreshing the grid and let us know if this helps. > >externalData.ExpandAll( ); >gridControl1.ResetVolatileData(); >gridControl1.Refresh( ); >gridControl1.UpdateScrollBars(); >this.gridControl1.Invalidate(); > >Kindly modify the attached sample to reproduce the issue here, if this does not help. >Sample : VirtualTreeGrid.zip > >Thanks for the patience. > >Best regards, >Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon