Of course. If you put HTML code in an input control (your
TextBox
is rendered as
HTML
input element), you can show the HTML source code, if you copy this code as is to the value.
If you want to show source HTML code in some non-input control, it will be shown as rendered HTML. If you want to show raw source code, you just need to escape all HTML markup with
character entities. Here is the list of them:
http://www.w3.org/TR/html4/sgml/entities.html[
^].
In .NET, you can do it, if you use
System.Web.HttpServerUtility.HtmlEncode
:
http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.htmlencode.aspx[
^].
OK, I see. The question is very ambiguous (please see my comment to the question). I can see yes another possible meaning of it. Perhaps you mean to show rendered HTML in
TextBox
. No, you cannot do it. Use some non-input element.
—SA