Render MVC PartialView into SignalR response

前端 未结 6 995
抹茶落季
抹茶落季 2020-12-13 04:19

I would like to render a PartialView to an HTML string so I can return it to a SignalR ajax request.

Something like:

SignalR Hub (mySignal

6条回答
  •  攒了一身酷
    2020-12-13 04:57

    Based on the answers supplied to asimilar question below, I would suggest using

    Html.Partial(partialViewName)

    It returns an MvcHtmlString, which you should able to use as the content of your SignalR reponse. I have not tested this, however.

    Stack Overflow Question: Is it possible to render a view outside a controller?

提交回复
热议问题