I'm trying to render a PartialView in my Controller. I need the HTML of the PartialView to be specific. I'm using this code in order to get the HTML. The problem that I have right now is that I don't get the rendered PartialView but the whole View. I need the HTML of the rendered PartialView for an email. The ViewEngineResult doesn't show any possible way of getting the PartialView.
Is there any way of getting the HTML of a PartialView?
This is how I'm using the code from the post
var partialView = PartialView("Index", viewModel);
var html = partialView.ToHtml(HttpContext);
I had to change the ViewResult parameter in the ToHtml() Method.
Before
public static string ToHtml(this ViewResult result, HttpContext httpContext)
After
public static string ToHtml(this PartialViewResult result, HttpContext httpContext)