@using (Html.BeginForm())
{
@Html.TextBoxFor(m => m.Name, new { @Value = "Name" })
@Html.TextBoxFor(m => m.Email, new { @Value = "Email" })
<input type="submit" value="Go" />
}
how do i add a css class to this and add padding? I have the following css i wish to add to try pad it a bit
.newsletterform
{
color:black;
padding-left:20px;
}
You can set the class with
@class="className"but you have to specify actionName, controllerName, FormMethod too because there is no overload ofHtml.BeginFormthat supports setting only html attributes.You can create your own html helper, that does that for you, too.
Update
Here is a custom html helper does that.
You can call the method from your view like this.
hope this helps