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

"AddNew not called" - GGC, IBindingList and IEditableObject


I'm using the GGC with a custom class as datasource. My custom class is a generic list that inherits from CollectionBase and implements the IBindingList interface. The elements of the list are also custom classes that implement the IEditableObject interface.

My implementation works fine in general terms. I'm able to display data on the grid properly and according to the format I need. Also, changes made to cell values are reflected back to the database via my class without any issues. The only issue I'm having is regarding the AddNewRow which is behaving in a funny way.

When I enter a value on any of the AddNewRow cells, a new item is added to the datasource (via AddNew method calling) and default values for all the fields are properly populated. I'm able to fill all cell values and when I either press enter or change to another cell the new row is "accepted" and a blank AddNewRow added to the grid. However, if rather than keep on entering values on row I change to another cell immediately after entering the first value I get the following error message on a pop-up window: "AddNew not called", which is launched by the GGC itself.

I spent some time debugging it and I noticed the following:

1) When I complete more than one cell value for the AddNewRow and then change to another cell, the Action property of CurrentRecordContextChangeEventArgs is set to EndEditCalled and then the EndEdit() method of my class is called.
2) When I complete just ONE cell value for the AddNewRow and then change to another cell, the Action property of CurrentRecordContextChangeEventArgs is set to EndEditCalled and then the CancelEdit() (!!!!) method of my class is called.

I would like to understand why is this happening (it looks like a bug to me) and what steps should I follow to overcome it. Please find attached my classes in case my implementation of the either the IBindingList or IEditableObject were the cause of the problem.

Please let me know if you need further information.

I look forward to your advice.

Regards,

Marcelo

classes.zip

9 Replies

AD Administrator Syncfusion Team November 23, 2006 11:06 AM UTC

Hi Marcelo,

Sorry for the inconvenience. I couldn't compile the sample as it is missing the following dll.

1) Jefferies.Core.Data.dll
2) Jefferies.Common.Data.Sql.DataAccess dll
3) and SqlDataManager class

Can you please send us the dll and class/sample, we will debug the issue here.

Best Regards,
Haneef


MG Marcelo Garcia Casil November 23, 2006 01:13 PM UTC

Sorry about that.

I'm attaching both the DLL and the .cs file, although you just need the .cs file as the .dll is just the compiled version.
The Jefferies.Core.Data dll is not needed and it must be removed from the "using" region. It's an old dll which is not in use anymore and I forgot to remove.

I hope it helps.

Thanks,

Marcelo

classes2.zip


AD Administrator Syncfusion Team November 24, 2006 12:32 PM UTC

Hi Marcelo,

Without a working sample, it is tough to guess what is going wrong. Hence I would strongly encourage you to prepare a small sample just to show the issue, so that we could debug it here. That would help us quicker identify the problem.

Thanks for your patience.

Best Regards,
Haneef


MG Marcelo Garcia Casil November 24, 2006 03:06 PM UTC

Hi,

Please find attached the working sample.

I look forward to your response.

Thanks,

Marcelo

GridSample1.zip


MG Marcelo Garcia Casil November 24, 2006 03:08 PM UTC

And you've got also here the source code of the dlls in case you want to debug them.

Thanks,

Marcelo

Common.zip


AD Administrator Syncfusion Team November 27, 2006 12:29 PM UTC

Hi Marcelo,

We will work out for a solution and let you know the details soon. Thanks for being patience.

Best regards,
Haneef


MG Marcelo Garcia Casil November 27, 2006 05:35 PM UTC

Thanks, I look forward to it.


AD Administrator Syncfusion Team November 28, 2006 11:14 AM UTC

Hi Marcelo,

Thanks for the update.

Instead of calling the ConfirmChanges method in RecordValueChanging event, you can use the CurrentCell.Validate method to validate the CurrentCell in a grid. Here is a code snippet.

//validations
this._gridSpreadsheet.TableControl.CurrentCell.Validate();

Best Regards,
Haneef


MG Marcelo Garcia Casil November 28, 2006 11:27 AM UTC

It works fine. Thank you!

Loader.
Live Chat Icon For mobile
Up arrow icon