1

My project has the standard jquery.toast alerts. I would use the asp.net DataAnnotations to validate the fields, but keeping the toast to view messages, someone would know if it's possible?

Examples: cs

public class IndexBaixaArquivoModel
    {
        [StringLength (6, MinimumLength = 6)]
        [Remote ("")]
        [Display (Name = "Board")]
        public string Board {get; set; }

        [DisplayFormat (DataFormatString = "dd / mm / yyyy")]
        [Display (Name = "Start Date")]
        public DateTime PeriodoInicial {get; set; }

        [DisplayFormat (DataFormatString = "dd / mm / yyyy")]
        [Display (Name = "Start Date")]
        public DateTime PeriodoFinal {get; set; }

        public bool PossuiImagemDigital {get; set; }

        public bool PossuiMulta {get; set; }
    }

.cshtml

@Html.EditorFor (model => model.Placa)
@Html.ValidationMessageFor (model => model.Placa, "Informed card is invalid")

js (toast call)

ExibirErro function (message) {
.toast $ ('<b> Error </ b> </ br>' + message, 
     {duration: 10000, sticky: false, type: 'danger'});
}
teo van kot
  • 12,350
  • 10
  • 38
  • 70

0 Answers0