Is it possible to add style attributes to a Html.BeginForm?
Something like:
@using (Html.BeginForm("Action","Controller", FormMethod.Post, new {@class="myClass"}, new {@style="margin-right:100px margin-top:50px"}))
{
}
try
@using (Html.BeginForm("Action", "Controller", FormMethod.Post, new { style = "margin-right:100px; margin-top:50px", @class = "myClass" }))
{
}
//Try this format
@using (Html.BeginForm("Action", "Controller", null,FormMethod.Post, new { @style = "your styles ",@class = "your classname"}))
{
}
Look here:
StackOverflow Link
Another StackOverflow Link
I'm not MVC expert, but according to attached links Your code should like this:
@using (Html.BeginForm("Action","Controller", FormMethod.Post, new {@class="myClass"}, new {style="margin-right:100px margin-top:50px"}))
{
}
Hope this helps. :)
@using (Html.BeginForm("Index", "Home", null, FormMethod.Post, new { style = "margin-right:100px;margin-top:50px;border:1px solid red;", @class = "thFormClass" }))
{
}
Try this it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With