How do you render a User control from a ashx or webservice?

Question is it possible to have a .ashx or webservice return a user control rendered? if so how would i do this?

14.10.2009 00:47:54

This post from our beloved Scottgu might help you :)

14.10.2009 00:49:44

If your not using MVC, you can get the HTML of a control at bind time by using the RenderControl method.


14.10.2009 00:56:50

I haven't tried this, but you might be able to do this by calling the RenderControl method.

14.10.2009 00:58:38
The web-service can in fact send back controls by first converting to string using RenderControl (on serverside) and then, on the client side using {MyDiv = document.getElementById('Div1'); MyDiv.innerHTML = arg;} in the OnComplete method, but I cannot seem to pass on javascript that would execute on the client. Anyone managed to execute javascript using this method?
gouderadrian 18.01.2013 10:14:44

The only problem is that you can use ASP controls as they need to be inside runaat="server" control. Or at least I still do not have any solution to that problem

17.07.2014 06:22:29