创建控制器的HtmlHelper实例 [英] Create HtmlHelper instance in Controller
本文介绍了创建控制器的HtmlHelper实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要控制器的HtmlHelper做的,所以我如何控制创建(asp.net的MVC 2.0)?
I need to do with HtmlHelper in Controller, so how i create it in Controller (asp.net mvc 2.0)?
推荐答案
这是你想要的吗?
修改
使用此;
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();
这篇关于创建控制器的HtmlHelper实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文