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

前端 未结 12 1631
星月不相逢
星月不相逢 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:36

    Why not just use css !important and call it a day:

    /* Styles for validation helpers
    -----------------------------------------------------------*/
    .field-validation-error {
        color: #f00 !important;
    }
    
    .field-validation-valid {
        display: none;
    }
    
    .input-validation-error {
        border: 1px solid #f00 !important;
        background-color: #fee !important;
    }
    
    .validation-summary-errors {
        font-weight: bold;
        color: #f00;
    }
    
    .validation-summary-valid {
        display: none;
    }
    

提交回复
热议问题