I need to do with HtmlHelper in Controller, so how i create it in Controller (asp.net mvc 2.0)?
+3
A:
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();
griegs
2010-01-18 04:19:32
it for old mvc version
complez
2010-01-18 04:23:21
Are you saying that it doesn't work? These types have changed only minimally between ASP.NET MVC 1.0 and ASP.NET MVC 2. If it doesn't work then let us know what doesn't work.
Eilon
2010-01-18 04:25:46