1

I have a .net panel, and I want to send this panel via outlook to other recipients. For this I think I have to find the html code of this element. How to do that ?

Thanks.

stckvrflw
  • 1,489
  • 3
  • 22
  • 37

1 Answers1

4

Use the RenderControl method to output the contents to an HtmlTextWriter.

Example, which outputs the content to a StringBuilder.

StringBuilder content = new StringBuilder();
StringWriter sWriter = new StringWriter(content);
HtmlTextWriter htmlWriter = new HtmlTextWriter(sWriter);
pnlMyPanel.RenderControl( htmlWriter );
MisterZimbu
  • 2,673
  • 3
  • 27
  • 28
  • This is helping me b/c I'm receiving the must be in webform error, if your asp.net control contains any button controls, etc: http://www.4guysfromrolla.com/articles/122006-1.aspx – Nathan Prather Nov 07 '16 at 22:58