How to get HTML of HtmlControl object in backend
Posted
by jlech
on Stack Overflow
See other posts from Stack Overflow
or by jlech
Published on 2010-04-23T20:10:11Z
Indexed on
2010/04/23
20:13 UTC
Read the original article
Hit count: 233
I have a short snippet of C# code like this:
HtmlGenericControl titleH3 = new HtmlGenericControl("h3");
titleH3.Attributes.Add("class", "accordion");
HtmlAnchor titleAnchor = new HtmlAnchor();
titleAnchor.HRef = "#";
titleAnchor.InnerText = "Foo Bar";
titleH3.Controls.Add(titleAnchor);
What I want is a way to return a string that looks like this:
<h3 class="accordion"><a href="#">Foo Bar</a></h3>
Any thoughts or suggestions?
© Stack Overflow or respective owner