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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error during Refresh when there is a selection before Refresh and no data after Refersh

Thread ID:





55167 Jan 24,2007 04:27 PM UTC Jan 25,2007 06:15 AM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On January 24, 2007 04:27 PM UTC


The virtual grid has data and a row is selected in it. Now the data is cleared and ResetVolatileData is called. When Refresh is called, the QueryCellInfo gets fired for the selected row index which is no more valid and exception is thrown.

Steps to reproduce:

.Net2.0, VS2005 and Essential Studio:

Execute the attached sample. Click on 'Load Data' button. Data will be loaded and donot select any row. Clicking on the same button will clear all data. No problem so far. Now click again on 'Load Data' button and select one of the rows. Click on the same button to clear all data, ArgumentOutOfRangException is thrown.

Scenario briefly:

I have readonly virtual grid derived from grid control (FFGrid). The data for the grid is provided by class implementing IVirtualGridDataProvider interface. In the sample attached, this class is ListDataProvider and this is attached to the grid using FFGrid.WireDataProvider().
When there is change in data, the data provider raises event for which the grid is listening. The code inside event handler:


The CalculateColRatios() recalculates the col ratios based on new data and calls Refresh(). During this step the error is happening.

why is QueryCellInfo being fired for rowindex > 0 even though the row count is 0 ?

Another issue, the sort icon doesn't get displayed clicking on the header column.

Let me know how do I fix the above issues. Thanks.



Administrator [Syncfusion]
Replied On January 24, 2007 08:20 PM UTC

Hi Kiran,

Issue 1: Load button

Before the resetting the dataProvider, you need to call the CurrentCell.Deactivate method to deactivate the currentcell.

//Load button click event
if (button1.Text.Contains("Data"))
button1.Text = "Load None";
_dataProvider.DataList = new List();
button1.Text = "Load Data";

Issue 2 : Sorting Icon

The reason for not displaying the SortIcon in your case is that you are setting Model.ReadOnly property to true. One way you can do this by handling the QueryCellInfo event of the grid and set theStyle.Tag and Style.CellType for sort column when clicked on the column header. Please refer to the modified sample for more details.

void FFGrid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
if (e.ColIndex == this.SortColumn && e.RowIndex == 0
&& SortDetails.Contains(e.ColIndex) )
e.Style.CellType = "SortHeader";
e.Style.Tag = SortDetails[e.ColIndex];

Here is a modified sample.

InVirtual Grid, Model.Data doesn't holds the any cellvalue information. If you want to sort the data in virtual grid, you need to sort the underlying datasource (_dataPropvider.DataList in your sample application). Here is a sample that shows How to sort the data in a Virtual Grid.



Administrator [Syncfusion]
Replied On January 25, 2007 06:15 AM UTC

Thanks Haneef!



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon