Idsa Idsa - 1 month ago 7
CSS Question

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

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

Answer

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.

Comments