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.

Grid Control CurrentCell not reset when RowCount = 0

Thread ID:

Created:

Updated:

Platform:

Replies:

94682 May 26,2010 05:07 PM Jun 2,2010 12:42 AM Windows Forms 3
loading
Tags: GridControl
Julie Levy
Asked On May 26, 2010 05:07 PM

Hi -
I have a situation where the only row of a GridControl is removed using Rows.RemoveRange and the CurrentCell object is still representing a cell in that row (which was the current cell when the row was removed). This is causing problems in our code in keypress events (where the rowindex and columnindex are still set to that cell) as well as the CurrentCellChanged event which is firing (see my attached screenshot). The Renderer is null so i can check for that in the event, but i'm wondering if there's something that can be done to null out the CurrentCell so that the events don't fire.

I don't know if this is a bug or due to something i'm doing in code. It's present in both versions 5.2 (VS2005) and 7.4 (VS2008).
Thanks,
Julie





CurrentCell_NoRows_1751ae93.zip

Christopher Issac Sunder K [Syncfusion]
Replied On May 28, 2010 10:38 AM

Hi Julie,

Thank you for your interest in Syncfusion products.

While removing the rows using RemoveRange() method, the current cell renderer cannot get refreshed and notifies the old indexes. Hence, we can make use of MoveTo() method after removing the range to force the current cell to refresh.

Here is the code snippet regarding this,

this.gridControl1.Rows.RemoveRange(0, this.gridControl1.RowCount);
if (this.gridControl1.RowCount == 0)
{
this.gridControl1.CurrentCell.MoveTo(0, 0, GridSetCurrentCellOptions.SetFocus); //refresh the current cell

}

Please refer the following sample which illustrates the above.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F946821951706273.zip

Please let me know if you have any further concerns.

Regards,
Christopher K.

Julie Levy
Replied On June 1, 2010 05:42 PM

Thanks. That worked.

Christopher Issac Sunder K [Syncfusion]
Replied On June 2, 2010 12:42 AM

Hi Julie,

Thank you for the update.

We are glad to hear this.

Thank you for using Syncfusion products.

Regards,
Christopher K.

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.

;