Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
So I'm trying to add a class to the form element and the form is generated using the following code:
@using(Html.BeginUmbracoForm<SearchFormSurfaceController>("HandleSearchForm"))
I've tried doing the following:
@using(Html.BeginUmbracoForm<SearchFormSurfaceController>("HandleSearchForm", new { @class = "myclass" }))
This doesn't throw any errors however doesn't add a class to the form element.
To add a class to a label for example is easy:
@Html.LabelFor(model => model.Weight, new { @class = "myclass" })
Thanks.
you're using the wrong overload, if passing 2 params, 2nd is supposed to route values, so, you must use
@using(Html.BeginUmbracoForm<SearchFormSurfaceController>("HandleSearchForm", null, new { @class = "myclass" }))
Cheers,
/Dirk
Thanks for answer Dirk.
Doh! Thank you very much.
Is there documentation that lists arguments etc? Sorry I'm just getting started with MVC.
I know of http://our.umbraco.org/documentation/Reference/Mvc/, haven't seen anything better than this
Anyway, it was Resharper helping me out here!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Cannot set class on form using Html.BeginUmbracoForm in MVC
So I'm trying to add a class to the form element and the form is generated using the following code:
@using(Html.BeginUmbracoForm<SearchFormSurfaceController>("HandleSearchForm"))
I've tried doing the following:
@using(Html.BeginUmbracoForm<SearchFormSurfaceController>("HandleSearchForm", new { @class = "myclass" }))
This doesn't throw any errors however doesn't add a class to the form element.
To add a class to a label for example is easy:
@Html.LabelFor(model => model.Weight, new { @class = "myclass" })
Thanks.
you're using the wrong overload, if passing 2 params, 2nd is supposed to route values, so, you must use
@using(Html.BeginUmbracoForm<SearchFormSurfaceController>("HandleSearchForm", null, new { @class = "myclass" }))
Cheers,
/Dirk
Thanks for answer Dirk.
Doh! Thank you very much.
Is there documentation that lists arguments etc? Sorry I'm just getting started with MVC.
I know of http://our.umbraco.org/documentation/Reference/Mvc/, haven't seen anything better than this
Anyway, it was Resharper helping me out here!
Cheers,
/Dirk
is working on a reply...