Having a problem with CanSave

Having a problem with CanSave

Old forum URL: forums.lhotka.net/forums/t/10053.aspx

Hamchuck posted on Wednesday, February 09, 2011

I'm using Csla 4.1 along with Bxf, and a ViewModel based on a DynamicBindingListBase. For some reason that I don't understand the CanSave is always false. When I debug the code in ViewModelBase.ca, in the method SetProperties the first line is

ITrackStatus targetObject = Model as ITrackStatus;

If I look at the value of Model is not NULL but equals the number of records in the DBLB, I'll step to the next line and inspect targetObject and its Null, its always NULL and because of that the following lines of code never get executed and the CanSave is always False.  Is this happening because I'm using a DBLB business object ?

// Does Model instance implement ITrackStatus

if (targetObject !=null)


  CanSave = CanEditObject && targetObject.IsSavable && !isObjectBusy;



Hamchuck replied on Wednesday, February 09, 2011

I have since changed the BO to a Editable Root List and now the CanSave works as expected.

Does a DBLB support CanSave ?

Or is this a bug of somekind ?

Or is there something I'm missing in reguards to a DBLB object ?

JonnyBee replied on Wednesday, February 09, 2011

DynamicListBase will save changes immediately to each row when another object is selected.
(ie - Nether you or the ViewModel can control the Save method).

So the ViewModel is created for BusinessListBase lists - not DynamicListBase lists and will not work well with DynamicListBase .

Read the preveious threads about VievModelBase and DynamicListBase:


and http://forums.lhotka.net/forums/p/9978/46789.aspx#46789


Copyright (c) Marimer LLC