How to get processed html for a control in ASP.NET?

How can I get html rendering for a web control in ASP.NET?

For example, for example:

dim controlHTML as string = myControl.GetHTML()
+3
source share
2 answers
System.Text.StringBuilder sb = new System.Text.StringBuilder();
using (System.IO.StringWriter sw = new System.IO.StringWriter(sb))
using (System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw))
{
    mycontrol.RenderControl(hw);
}
+6
source

You should call it .RenderMethod and pass in the HtmlTextWriter and get the content from it.

+4
source

Source: https://habr.com/ru/post/1721300/


All Articles