I’ve seen a few examples of people using this syntax for HTML.BeginForm:
(Html.BeginForm<Type>(action => action.ActionName(id)))
But when I try this syntax all I get is a:
The non-generic method System.Web.Mvc.Html.FormExtensions.BeginForm(System.Web.Mvc.HtmlHelper)'
cannot be used with type arguments
What am I missing?
Visual Studio 2010, System.Web.MVC version is v2.0.50727
You will find this extension methods in MVCContrib and more specifically in the
Microsoft.Web.Mvc.dllassembly in theMicrosoft.Web.Mvc.FormExtensionsclass. So download and include this assembly in your project and add theMicrosoft.Web.Mvcnamespace in thenamespacessection of your web.config file:and you will be able to use it in your views.