Edit: I forgot to mention neither the ActionLink<> or BeginForm<> has worked form me, I have latest MVC version (looked at the available updates for project from NUGET , mvc was not in the recommended list). Is there a sample tutorial/example that uses this feature?
In question "What is an alternative to using strings for action and controller names in asp.net MVC?" I received an answer to use this answer What is the syntax for a strongly-typed ActionLink in MVC 4 with MVC 4 Futures?
I have tried to do what they have done with Action link e.g. :
@(Html.ActionLink<CustomersController>(x => x.Index(), "Customers"))
But similar did not even compile :
Html.BeginForm<CustomersController>(x => x.Index())
Is there some namespace I need to add or a different syntax I need to try?
Update 2 : This is what I have :
@using (Html.BeginForm<UnitTestsController>( x => x.Index()) )
UnitTestsController is refereced ok, intellisense wouldn't even allow x => x.Index()) , I had to hammer it in.
Also added System.Linq namespace, but is not being used (grayed out by Reshaper)
The error at run time is :
Compiler Error Message: CS0308: The non-generic method 'System.Web.Mvc.Ajax.AjaxExtensions.BeginForm(System.Web.Mvc.AjaxHelper, string, string, System.Web.Routing.RouteValueDictionary, System.Web.Mvc.Ajax.AjaxOptions, System.Collections.Generic.IDictionary)' cannot be used with type arguments
Microsoft.Web.Mvcnamespace? And FYI, refer this answer for info on the 'Futures' projectBeginForm()method here and theActionLink()hereBeginFormprovided bySystem.Web.Mvccurrently doesn't include type arguments, thus you need to create custom html form helper or use MVC4 Futures.