Is their a solution to generate an email template using an ASP.NET MVC View without having to jump through hoops.
Let me elaborate jumping through hoops.
I created an overload to LukLed's RenderSparkToString method that allows you to use a spark layout along with your view:
public static string RenderSparkToString(this Controller controller,
string viewName, string masterName, object viewData)
{
var view = ViewEngines.Engines.FindView(controller.ControllerContext, viewName, masterName).View;
//Creating view context
var viewContext = new ViewContext(controller.ControllerContext, view,
controller.ViewData, controller.TempData);
var sb = new StringBuilder();
var writer = new StringWriter(sb);
viewContext.View.Render(viewContext, writer);
writer.Flush();
return sb.ToString();
}
I agree with Andrew though. I wish there was an easier way to do this with the web forms view engine.