DataGridView error saving businesslistbase

DataGridView error saving businesslistbase

Old forum URL:

gwilliams posted on Saturday, November 12, 2011

I have a simple collection that is loaded from a flat file. This needs to be displayed on a read only grid then saved to a db. As long as I do not bind the list to a datagridview it will exit the save properly. If the datasource of the grid is set to the list then I get an error : ‘DataPortal.Update failed (Csla.Validation.ValidationException: Object is still being edited and can not be saved’


I have tried setting the datagridview.datasource to null and still no luck. Tried changing the base to a childbase and I get : cant save a child directly.(something like that)


Binding from the form:

displayClaimsList = ClaimsListing.GetClaimsListing(path);

dataGridView1.DataSource = displayClaimsList;





in the businesslistbase

protected override void DataPortal_Update()


        foreach (var item in this)


            bool what = item.IsNew;//checking to make sure all items are marked as new.





In the businessbase it is hitting the dataportal_Insert. (when it has not been bound to the datagrid)


Any ideas. What am I missing……

also i am not using a winpart or anything.. just a form with 2 buttons, one to load the data into the listing and bind to the datagridview... the other to save

RockfordLhotka replied on Saturday, November 12, 2011

This is Windows Forms right? You need to unbind the object from the UI before saving, otherwise data binding maintains currency to one item in the collection. As a result, the edit level for that one item is elevated - hence the exception you are seeing.

There is a specific way you need to unbind. This is discussed in the Using CSLA .NET 3.0 ebook, and is demonstrated in ProjectTracker in the version 3.0.5 download.

gwilliams replied on Saturday, November 12, 2011

thanks for the prompt reply. I will grab the 3.0.5 download and purchase the 3.0 ebook. I have the video's and was going to review them as well.

We are in year 2 of a medical transport app witht he business objects done in CSLA. The team was new to CSLA and we have ran into some implementation problems along the way. the main challenge in the project has been the dynamic nature of the rules which are based on contracts, and where some of the rules are determined from an external rules application. Are there any video's or tutorials that walk through implementation or discuss which "Base" object is a better choice over another.? this applicaton is more business centric as the data is compliled from disperse sysetems.

JonnyBee replied on Sunday, November 13, 2011

Hi Greg,

As a general rule for WindowsForms I recommed to use BindingSource as an intermediate beetween DataGridView and your BO.

Also take a look at the Csla.Windows.BindingSourceExtensions.cs in CslaContrib trunk. (
This class contains helper method to bind/unbind your BO properly.

gwilliams replied on Sunday, November 13, 2011

thanks JonnyBee. I am having some trouble finding the file. i downloaded the lates Contrib project but do not see it nor do i see it in a previous one. is this a single file download? i am missing something. but will keep looking.

gwilliams replied on Sunday, November 13, 2011

found it.

gwilliams replied on Tuesday, November 15, 2011

everything is working now that i am unbinding per the instructions. thanks all.

Copyright (c) Marimer LLC