Blazor and CSLA Validator #2400
Replies: 4 comments 6 replies
-
Are you following the coding pattern from the ProjectTracker sample and/or my CSLA Blazor book when creating the component? Can you share your component code? |
Beta Was this translation helpful? Give feedback.
-
Within the page, here is the code using the component. <EzComboBox @bind-BindingValue="@vm.Model.Status"> The component code is below I also attached my business object. The component is bound to the status field. Thanks, Mike @using System.Linq.Expressions
<DxComboBox TextFieldName="@nameof(StatusField.StatusName)"
ValueFieldName="@nameof(StatusField.StatusLetter)"
DropDownWidthMode="DropDownWidthMode.ContentWidth"
CssClass="cmbStatus cmbStatusWidth"
ValueExpression="@(() => BindingValue )"
ValueChanged="@BindingValueChanged"
Data="StatusTypes.Statuses"
Value="@BindingValue">
</DxComboBox>
@code { private string _value;
[Parameter]
public string BindingValue
{
get =>
_value;
set
{
if (_value == value) return;
_value = value;
BindingValueChanged.InvokeAsync(value);
}
}
[Parameter]
public EventCallback<string>
BindingValueChanged
{ get; set; }
public class StatusField
{
public string StatusName { get; set; }
public string StatusLetter { get; set; }
}
public static class StatusTypes
{
private static readonly Lazy<List<StatusField>> statuses = new Lazy<List<StatusField>>(() =>
{
return new List<StatusField>()
{
new StatusField() {StatusName = "Active", StatusLetter = "A"},
new StatusField() {StatusName = "Inactive", StatusLetter = "I"},
new StatusField() {StatusName = "Xiscontinued", StatusLetter = "D"},
};
});
public static List<StatusField> Statuses { get { return statuses.Value; } }
} My object isn't an exact match to the example, but I think it's close. I have the code split across 2 units so I attached them both. Thanks Mike |
Beta Was this translation helpful? Give feedback.
-
After lots of playing I confirmed the cslavalidator gets upset when it can't resolve the bind-Value of a control. If I place a devexpress dxComboBox directly on my page and set bind-Value to a string variable I get the same error pointing at IcheckRules. Is it possible to tell the validator to skip certain fields? Mike |
Beta Was this translation helpful? Give feedback.
-
Added to backlog: #2462 |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have a blazor server app using CSLA 5.5 and NetCore 5. I'm using devexpress blazor controls and have a weird issue. A combo box functions normally when placed on the page, but if I place the combobox in a component I get the error below when changing data. I only get this error if a CSLA validator is on my page. If I remove the CSLA validator the error goes away. My guess is the validator is looking for a property I'm not exposing in the component.
Beta Was this translation helpful? Give feedback.
All reactions