如何从 Controller 或外部类库中的其他方法调用Html.Partial()
方法?
我需要这样的东西:
string someView = "SomeView";
object someModel = new SomeModel();
HtmlHelper helper = new HtmlHelper();
string html = helper.Partial(someView, someModel).ToString();
我需要获取此方法返回的 html 字符串。
最佳答案
如果您想将部分 View 呈现为字符串,您可以使用此链接:Render a view as a string
但我认为你做错了什么......
关于c# - 如何将部分 View 呈现为字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11047198/