Html.ValidationSummary(false, “message”) is always showing, even on page load

If you use a developer tool in your browser to inspect the validation summary text you’ll see that it has the class validation-summary-valid when it is clear but validation-summary-errors when there are form errors. Therefore, just create a css rule as follows; .validation-summary-valid { display:none; } and all should be good.

Show ValidationSummary MVC3 as “alert-error” Bootstrap

edited again I misunderstood your question at first. I think the following is what you want: @if (ViewData.ModelState[“”] != null && ViewData.ModelState[“”].Errors.Count > 0) { <div class=”alert alert-error”> <button type=”button” class=”close” data-dismiss=”alert”>×</button> @Html.ValidationSummary(true, “Errors: “) </div> }

Custom ValidationSummary template Asp.net MVC 3

My approach is to use a custom ValidationSummary.cshtml: @model ModelStateDictionary @if(!Model.IsValid) { <div class=”validation-summary-errors”> <ul> @foreach (var modelError in Model.SelectMany(keyValuePair => keyValuePair.Value.Errors)) { <li>@modelError.ErrorMessage</li> } </ul> </div> } Put this partial view in your Shared folder and refer to it from your code: @Html.Partial(“_ValidationSummary”, ViewData.ModelState); This way you remain in full control of your html.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)