Not sure how you do this, since you haven't provided the code. Also not sure why you will need such a strange thing :-) Not very common, maybe there is an alternative approach. You can provide more detailed information so that we can offer the best option, if any.
I would say that you could do this, but you need to create a control and invoke rendering programmatically, like this
TextWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); userControl.RenderControl(htmlWriter); string html = stringWriter.ToString();
After that, you should add the html variable to your answer.
This code must be placed in a method marked as WebMethod or an HTTP handler so that you can call it from your javacript.
Example: calling WebMethods from javascript
Example: calling HTTP handlers from javascript
source share