Using HtmlHelper in a Controller

后端 未结 7 1468
悲哀的现实
悲哀的现实 2020-11-27 04:34

Is it possible to use HtmlHelper in a controller, for-example to get the TextBox(...) method? not that I can\'t write the html that it generates myself, but I just want to u

7条回答
  •  臣服心动
    2020-11-27 05:04

    • using System.Web.Mvc;
    • using System.Web.Mvc.Html;

       HtmlHelper helper = new HtmlHelper(new ViewContext(ControllerContext, new            WebFormView(ControllerContext, "Index"), new ViewDataDictionary(), new TempDataDictionary(), new System.IO.StringWriter()), new ViewPage());
      

提交回复
热议问题