Create HtmlHelper instance in Controller
问题 I need to do with HtmlHelper in Controller, so how i create it in Controller (asp.net mvc 2.0)? 回答1: Is this what you want? Using HtmlHelper in a Controller EDIT Use this; System.IO.TextWriter writer = new System.IO.StringWriter(); var h = new HtmlHelper(new ViewContext(ControllerContext, new WebFormView("omg"), new ViewDataDictionary(), new TempDataDictionary(), writer), new ViewPage()); string g = h.TextBox("myname").ToString(); 回答2: You can use method like this: public static HtmlHelper