Sunday, May 19, 2024
Homepage · c#
 Popular · Latest · Hot · Upcoming
147
rated 0 times [  150] [ 3]  / answers: 1 / hits: 20522  / 11 Years ago, wed, october 16, 2013, 12:00:00

While using ASP.NET controls, for example



<h1 id=header runat=server>text</h1>


if we want to change the text of the header we can do it probably by two properties InnerHTML and InnerText. I want to know what is the basic difference between the two properties?


More From » c#

 Answers
13

InnerHtml lets you enter HTML code directly, InnerText formats everything you put in there for it to be taken as plain text.



For example, if you were to enter this in both properties: Hello <b>world</b>



This is what you would get with InnerHTML:




Hello world




That is, exactly the same HTML you entered.



Instead, if you use InnerText, you get this:




Hello <b>world</b>




And the resulting HTML would be Hello &lt;b&gt;world&lt;/b&gt;


[#74939] Tuesday, October 15, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
blaisep

Total Points: 748
Total Questions: 95
Total Answers: 108

Location: Federated States of Micronesia
Member since Sun, May 16, 2021
3 Years ago
blaisep questions
Wed, Dec 16, 20, 00:00, 4 Years ago
Sun, Aug 16, 20, 00:00, 4 Years ago
Tue, Nov 12, 19, 00:00, 5 Years ago
Mon, Nov 11, 19, 00:00, 5 Years ago
;