Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvc render partial view without httpContext or controller context

Is it possible to render partial view without ViewContext or ControllerContext?

  • I'm trying to get PartialView Html as string from outside of Controller Action.
  • OR
  • Is it possible to call Controller Action from another method? (this will allow me to execute controller action and get partial view html this way).
like image 928
ShaneKm Avatar asked Oct 05 '22 11:10

ShaneKm


1 Answers

You can try the Razor Generator Visual Studio Extension. Basically you run the custom tool on your view and it will generate a class that you can pass a model into and it will generate a string.

like image 161
Britton Avatar answered Oct 13 '22 11:10

Britton