我的项目有标准的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'});
}