ASP.Net MVC 3 Razor Response.Write position

后端 未结 4 1829
醉酒成梦
醉酒成梦 2021-02-12 17:47

I am trying to update this tutorial on implementing Facebooks BigPipe to razor.

There is a html helper extension that adds a pagelet to a list, and then outputs a holdin

4条回答
  •  清酒与你
    2021-02-12 18:01

    Change your method to be not void, but returning MvcHtmlString

    public static MvcHtmlString OutputText(this HtmlHelper helper, string text) {
         return New MvcHtmlString(text);
    }
    

    Than use this as you used to

    @Html.OutputText("FooBar");

    Idea is inspired by the fact that almost every input(and other) extension method in MVC returns MvcHtmlString

提交回复
热议问题