We are in the process of upgrading an ASP.NET MVC 1.0 application to the 2.0 release and some of the code requires the use of LinkExtensions which require an HtmlHelper to render. While we know that some of the code doesn't follow the MVC model correctly and are in the process of recoding as needed, we need something to work so get the application to build.
Here is the current syntax that we have that works under ASP.NET MVC 1.0:
public static HtmlHelper GetHtmlHelper(ControllerContext context)
{
return new HtmlHelper(new ViewContext(context,
new WebFormView("HtmlHelperView"),
new ViewDataDictionary(),
new TempDataDictionary()),
new ViewPage());
}
The error that we are getting is as follows:
Error 1 'System.Web.Mvc.ViewContext' does not contain a constructor that takes 4 arguments