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
close icon

Virtual Mode & Updating a single cell

I''m using the grid in virtual mode, and I''d like to update a single cell, i.e. I''d like to cause the QueryCellInfo event to fire for a given cell. How can I do this? thanks in advance, DM.

5 Replies

AD Administrator Syncfusion Team January 13, 2005 02:18 PM UTC

Try calling grid.RefreshRange and pass in a GridRangeInfo.Cell object holding the cell.


DM Dominic Morris January 14, 2005 09:20 AM UTC

Clay, As far as I can tell, that causes the event to fire for cells other than the one which I''ve invalidated. Our event handler performs an expensive cross-process function call; I''d like to be able to caus exactly one cell to be updated. Is it possible? DM.


AD Administrator Syncfusion Team January 14, 2005 09:57 AM UTC

What version of our DLL''s are you using? In the grid\samples\quickstatr\virtualgrid sample, I add a button to the form with this handler.
bool showDebug = false;
Random r = new Random();
private void button1_Click(object sender, EventArgs e)
{
	Console.WriteLine("Start");
	showDebug = true;
	this.gridControl1.RefreshRange(GridRangeInfo.Cell(r.Next(5) + 1, 4));
	Console.WriteLine("End");
	showDebug = false;
}
I then add this if at the top of GridQueryCellInfo.
if(this.showDebug)
	Console.WriteLine("GridQueryCellInfo {0},{1}", e.RowIndex, e.ColIndex);
Here is what I see when I run this on the output page when I run the sample in the debugger with 3010. Start GridQueryCellInfo 1,4 GridQueryCellInfo 1,-1 GridQueryCellInfo -1,4 GridQueryCellInfo -1,-1 End First, the cellstyle for 1,4 is gotten, then the rowstyle, then the colstyle and finally the tablestyle. So, if you checked for e.RowIndex > 0 and e.ColIndex > 0, then your code would be hit once due to the grid.RefreshRange call. But QueryCellInfo will be triggerred just by moving your mouse over the grid. (You can see this with the above code by commenting out the if-statement so the WriteLine is always hit in the GridQueryCellInfo.) The grid needs the style under the mouse to do appropriate hittesting, etc base on the style of the cell. So, you may be seeing these hits as opposed to teh hits due to explicit calls to RefreshRange. Now earlier versions did have some problems with refreshing too much, but I think they have been resolved since 2.1.0.9 (?). In this 3010 sample, Syncfusion\Essential Suite\3.0.1.0\Windows\Grid.Windows\Samples\Performance\OneTimeOnlyQueryCellInfo, there is a technique that shows how you can have a grid where QueryCellInfo is only hit once. This might be of interest to you.


DM Dominic Morris January 14, 2005 11:34 AM UTC

Thanks Clay, we are not using the latest version, but the one before that. What is the procedure for obtaining the latest version? What info. do we need to supply you in order to download the latest & greatest? thanks, DM.


AD Administrator Syncfusion Team January 14, 2005 12:01 PM UTC

3010 should be available for download from your DirectTtac support home page. You will need a new key, but if you have an active support contract, you will be able to retrieve that via the web. If you have any problems with this procedure, you can email sales@syncfusion.com with your contact details and they can get things straightened out.

Loader.
Live Chat Icon For mobile
Up arrow icon