class name in BeginFormAntiForgeryPost()

Topics: Writing themes
Jan 24, 2012 at 12:28 AM


Is there a way to add a style class to the Html.BeginFormAntiForgeryPost()? I tried Html.BeginFormAntiForgeryPost(new { @class = "form-stacked" }), but I'm missing some arguments apparently and I can't seem to figure out what they might be or if the tag will even take a class addition.


Jan 25, 2012 at 5:10 AM

Do a regular form and add the anti-forgery field yourself with Html.AntiForgeryTokenOrchard()

Jan 6, 2014 at 6:27 PM
Updating this old post. This can be done with one of the Html.BeginFormAntiForgeryPost overloads, ie.
@using (Html.BeginFormAntiForgeryPost(Url.Action("Action", "Controller", new { area = "Module" }), FormMethod.Post, new { @class = "my-form-class" })) 
Jan 7, 2014 at 7:59 PM
That's the solution I've been using Piotr. Thanks for posting the actual code though...I probably should have done that so others would have it as well =)