DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

ValidationSummary

in namespace DotVVM.Framework.Controls

Displays all validation messages from the current Validation.Target.

Properties

Name Type Description Notes Default Value
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
1
DataContext Object Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value.
attribute
inner element
static value
bindable
default
ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
IncludeErrorsFromChildren Boolean Gets or sets whether the errors from child objects in the viewmodel will be displayed too.
attribute
inner element
static value
bindable
default
False
InnerText String Gets or sets the inner text of the HTML element.
attribute
inner element
static value
bindable
default
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

Events

Name Type Description

Usage & Scenarios

Displays all validation errors in a list.

Look at the Validation tutorial to see how the validation works.

HTML Rendered by the Control

This control renders the HTML unordered list.

<ul data-bind="foreach: ...">
  <li data-bind="..."></li>
</ul>

Sample 1: Basic ValidationSummary

The ValidationSummary will display all validation errors in the validation context.

<dot:TextBox Text="{value: Text}" />

<dot:ValidationSummary />

<dot:Button Text="SEND" Click="{command: Send()}" />
using System.ComponentModel.DataAnnotations;

namespace DotvvmWeb.Views.Docs.Controls.builtin.ValidationSummary.sample1
{
    public class ViewModel
    {
        [Required]
        public string Text { get; set; }

        public void Send()
        {
            // process data
        }
    }
}

Sample 2: Validation errors from child objects

By default, the ValidationSummary control displays errors that comes directly from the Validation.Target object's properties. If the validation target contains another child objects, the validation errors from those objects are not displayed. This is because of performance reasons.

However, using the IncludeErrorsFromChildren property, you can tell the control to display validation errors event from the child objects. Just be careful because there will be a performance penalty if you use this feature on large and compilcated viewmodels.

<dot:TextBox Text="{value: ChildObject.Text}" />

<dot:ValidationSummary IncludeErrorsFromChildren="true" />

<dot:Button Text="SEND" Click="{command: Send()}" />
using System.ComponentModel.DataAnnotations;

namespace DotvvmWeb.Views.Docs.Controls.builtin.ValidationSummary.sample2
{
    public class ViewModel
    {
        public ChildViewModel ChildObject { get; set; } = new ChildViewModel();

        public void Send()
        {
            // process data
        }
    }

    public class ChildViewModel
    {
        [Required]
        public string Text { get; set; }
    }
}

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message