I have an application that is made up of 10+ related ascx files that we use to display our data on the users browser using the Html.RenderPartial helper.
I need to e
In regular asp.net you can override the Render() and provide your own HtmlWriter to intercept the rendered html before copying it to the HtmlWriter that was passed in.
I don't know off the top of my head how you'd intercept this in MVC, but I'm sure you'll be able to do it - especially if you make a new HttpModule in the pipeline to pre-post process the output stream.
http://www.brightmix.com/blog/renderpartial-to-string-in-asp-net-mvc/ has a good solution for rendering a View to a string so you can send it in email.
/// Static Method to render string - put somewhere of your choosing
public static string RenderPartialToString(string controlName, object viewData)
{
ViewDataDictionary vd = new ViewDataDictionary(viewData);
ViewPage vp = new ViewPage { ViewData = vd };
Control control = vp.LoadControl(controlName);
vp.Controls.Add(control);
StringBuilder sb = new StringBuilder();
using (StringWriter sw = new StringWriter(sb))
{
using (HtmlTextWriter tw = new HtmlTextWriter(sw))
{
vp.RenderControl(tw);
}
}
return sb.ToString();
}