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.
Syncfusion Feedback

Null reference exception when attempting to delete a record after a closing a dropdown combo in the recordvaluechanging event

Thread ID:

Created:

Updated:

Platform:

Replies:

67523 Aug 21,2007 06:43 PM UTC Aug 23,2007 01:23 PM UTC Windows Forms 1
loading
Tags: Grouping
James Blibo
Asked On August 21, 2007 06:43 PM UTC

I have a ggc that have a combo box in a row. When the user select a value in the combo box, I want to delete the row based on a certain logic that I am checking in the RecordValueChanging event.

However, I am getting an null reference exception in the TableControlCurrentCellCloseDropDown event, which I am also using like this...

private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e)
{
if (e.Inner.PopupCloseType == Syncfusion.Windows.Forms.PopupCloseType.Done)
{
e.TableControl.CurrentCell.EndEdit();
e.TableControl.Table.EndEdit();
}
}

The issue is that the RecordValueChanging event fires before I the TableControlCurrentCellCloseDropDown event, so the called to e.TableControl.Table.EndEdit(); is raising the null reference error because I have already deleted that record.

Jeba S [Syncfusion]
Replied On August 23, 2007 01:23 PM UTC

Hi James,

Thank you for your details.

You can avoid the NullReferenceException by lock and unlock the current cell. The Lock / Unlock blocks any changes to the active current cell.

Please refer this code snippets:

private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e)
{
if (e.Inner.PopupCloseType == Syncfusion.Windows.Forms.PopupCloseType.Done && this.gridGroupingControl1.Table.CurrentRecord!=null)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
cc.ConfirmChanges();
cc.Lock();
((GridTableControl)cc.Grid).Table.CurrentRecordManager.EndEdit();
e.TableControl.CurrentCell.EndEdit();
e.TableControl.Table.EndEdit();
cc.Unlock();
}
}


Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

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.

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

;