Is there a way to create and render asp controls to a html string in the code-behind?

System.Web.UI. Control has a RenderControl(HtmlTextWriter) method that you can use to get the rendered content of the control as a string.

Up vote 0 down vote favorite share g+ share fb share tw.

C# .net asp.net html link|improve this question asked Nov 18 '09 at 16:31Kenneth J938926 83% accept rate.

System.Web.UI. Control has a RenderControl(HtmlTextWriter) method that you can use to get the rendered content of the control as a string: using(var sw = new System.IO.StringWriter()) // SW is a buffer into which the control is rendered using(var writer = new HtmlTextWriter(sw)) { myControl. RenderControl(writer); return sw.ToString(); // This returns the generated HTML.

}.

Awesome.Thanks. – Kenneth J Nov 18 '09 at 16:54.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions