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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

55167 Jan 24,2007 11:27 AM Jan 25,2007 01:15 AM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 24, 2007 11:27 AM

Issue:

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: 4.4.0.51

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:

this.Model.ResetVolatileData();
CalculateColRatios();

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.

Regards
Kiran

POC.FFGrid.zip

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

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"))
{
ffGrid1.CurrentCell.Deactivate(true);
FillData();
_dataProvider.Refresh();
button1.Text = "Load None";
}
else
{
ffGrid1.CurrentCell.Deactivate(true);
_dataProvider.DataList = new List();
_dataProvider.Refresh();
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.
ModifiedPOC.FFGrid.zip


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.

VirtGridSort.zip

Regards,
Haneef

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

Thanks Haneef!

Regards
Kiran

CONFIRMATION

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.

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.

;