This is a really handy little function for rendering a control to a string. Really handy if you want to pass back rendered HTML from a StaticPageMethod or WebService.
private static string GetRenderedControl(Control control)
{
HtmlTextWriter writer = new HtmlTextWriter(new StringWriter());
control.RenderControl(writer);
return writer.InnerWriter.ToString();
}
Thursday, October 16, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment