views:

18

answers:

1

Since i havn't access to the TemplateControl or page from a WCF service i was wondering if it was possible to render a custom control? If so how would one do it?

 private string GetRenderedHtmlFrom(Control control)
 {
        StringBuilder stringBuilder = new StringBuilder();
        StringWriter sw = new System.IO.StringWriter(stringBuilder);
        HtmlTextWriter htmlWriter  = new HtmlTextWriter(textWriter);
        control.RenderControl(htmlWriter );
        return stringBuilder.ToString();
 }

Thanks

A: 

This actually wasn't achievable and i ended up abandoning the idea. The rough solution i implemented was loading an html page, and using string.Format() to manipulate it then returned the results as a string and let the JavaScript 'load the control'.

Highstead