Skip to main content

MVCxBatchUpdateValues<T, S>.IsValid(T) Method

Gets a value that indicates whether an item from the underlying data source is valid.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

Declaration

public bool IsValid(
    T item
)

Parameters

Name Type Description
item T

The item from the underlying data source.

Returns

Type Description
Boolean

true if the item is valid; otherwise, false.

Remarks

The IsValid property allows you to indicate and handle errors for columns that are not visible in the UI.

if (batchValues.IsValid(person))
    PersonsList.UpdatePerson(person);
else {
    var oldObj = PersonsList.GetPersons().FirstOrDefault(p => p.PersonID == person.PersonID);
    if (batchValues.EditorErrors[person]["LastName"].Errors.Count > 0 && batchValues.EditorErrors[person]["MiddleName"].Errors.Count > 0) {
        person.LastName = oldObj.LastName;
        person.MiddleName = oldObj.MiddleName;
        PersonsList.UpdatePerson(person);
    } else
        batchValues.SetErrorText(person, "Correct validation errors");
}
See Also