为了账号安全,请及时绑定邮箱和手机立即绑定

如何将部分视图呈现为字符串

如何将部分视图呈现为字符串

慕工程0101907 2019-10-11 14:09:46
我有以下代码:public ActionResult SomeAction(){    return new JsonpResult    {        Data = new { Widget = "some partial html for the widget" }    };}我想对其进行修改,以便可以public ActionResult SomeAction(){    // will render HTML that I can pass to the JSONP result to return.    var partial = RenderPartial(viewModel);     return new JsonpResult    {        Data = new { Widget = partial }    };}这可能吗?有人可以解释一下吗?注意,我在发布解决方案之前编辑了问题。
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 359 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信