如何在jquery.toast中使用asp.net DataAnnotations

时间:2015-08-27 14:23:25

标签: c# jquery asp.net-mvc data-annotations toast

我的项目有标准的jquery.toast警报。我会使用asp.net DataAnnotations来验证字段,但保持toast查看消息,有人会知道它是否可能?

示例: 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(土司电话)

ExibirErro function (message) {
.toast $ ('<b> Error </ b> </ br>' + message, 
     {duration: 10000, sticky: false, type: 'danger'});
}

0 个答案:

没有答案