Saturday, 28 October 2017

MVC - How to add css class to @Html.ValidationSummary

Watch this example on YouTube



1. CSS
.float-right{
    float: right;
}

2. VIEW

@using (Html.BeginForm(null, null, FormMethod.Post))
{
    @Html.TextBoxFor(x=>x.Qty)
    <p class="red">@Html.ValidationSummary("Please fix the following errors",
                  new { @class="float-right"})</p>
    <input type="submit" />
}


No comments:

Post a Comment