stckvrflw
stckvrflw

Reputation: 1519

How to get HTML code of a .NET control

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.

Upvotes: 1

Views: 2262

Answers (1)

MisterZimbu
MisterZimbu

Reputation: 2713

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 );

Upvotes: 4

Related Questions