How to call CheckRulesAsync on an EditableList to validate all the items #2231
Unanswered
adrianwright109
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am using CSLA with Blazor and have successfully managed to create UI edit forms in Blazor for CSLA objects that inherit from
BusinessBase<T>
The UI edit components make use of the
Csla.Blazor.ViewModel<T>
to wrap the model so when I try and save the form I can callCheckRulesAsync()
on theModel
to update theIsSavable
flag and only save if there are no validation errors.The code I am using looks like this:
I would like to do a similar thing for an EditableList e.g. a class that inherits from
Csla.BusinessListBase<T, C>
Using the same
Csla.Blazor.ViewModel<T>
wrapper approach but using the EditableList as theModel
theTrySave()
method above works but only if I comment out the call toCheckRulesAsync()
otherwise it throws an exception: Specified cast is not valid..How can I successfully check that all items in the EditableList pass validation rules and are valid to save ?
Update 1 also just noticed that the
ModelPropertyChanged
on theCsla.Blazor.ViewModel<T>
wrapper when theModel
is an EditableList doesn't fire when editing a child item. Do I have to raise an event from the child item to the parent EditableList ?Update 2 also just noticed that when I try to get the PropertyInfo from a
boolean
IsActive
property on child items in the EditableList by using:It seems to get the PropertyInfo like the
FriendlyName
etc correctly but theValue
property is always null.I am using the EditableList with a Telerik Blazor Grid the EditableList is the grid data model and it produces a grid row for every child object in the list (I have 3 items in the list with
boolean
IsActive
properties set to false, true, true respectively.When I try and get the PropertyInfo to pass into the
CslaSwitch
component it returns null as the PropertInfo.Value rather than one of the actual boolean values.Code I have is:
Beta Was this translation helpful? Give feedback.
All reactions