Reviewing the documentation for using the Validator
If you want to validate some property, just use standard attributes from the System.ComponentModel.DataAnnotations namespace. DotVVM can translate some validation rules into javascript, so the validation can be executed also on the client side.
Then I developed the following code:
using System;
using DotVVM.Framework.ViewModel;
using APP_MIS_FACTURAS.Models;
using System.Web;
using DotVVM.Framework.Controls.Bootstrap;
using System.ComponentModel.DataAnnotations;
namespace APP_MIS_FACTURAS.ViewModels
{
public class InicioViewModel : DotvvmViewModelBase
{
[Required(ErrorMessage = "No se indica la contraseña del usuario")]
public string usuario { get; set; }
public string password { get; set; }
}
}
But I get the following error:
Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Required' could not be found (are you missing a using directive or an assembly reference?) APP_MIS_FACTURAS C:\Users\leojfn\Documents\Visual Studio 2015\Projects\Cystem\APP_MIS_FACTURAS\APP_MIS_FACTURAS\ViewModels\InicioViewModel.cs 45 Active
I do not know if I need to import some specific library or I need to install something NuGetPackage