Apply Twitter Bootstrap Validation Style and Message to ASP.NET MVC validation

前端 未结 12 1617
星月不相逢
星月不相逢 2021-01-30 00:57

How can I integrate ASP.NET MVC unobtrusive validation and Twitter Bootstrap? I want to have all those validation messages and styles appropria

12条回答
  •  隐瞒了意图╮
    2021-01-30 01:48

    I suggest to include Bootstrapper in less format and do the same thing as Iridio suggested but in .less. That way you could have something like:

    .validation-summary-errors
    {
        .alert();
        .alert-error();
    }
    .field-validation-error 
    {
        .label();
        .label-important();
    }
    

    so when bootstrapper will change you'll pick up the changes automatically. Regular styles that handle visibility from MVC default Site.css will stay in place and handle visibility.

提交回复
热议问题