Click here to Skip to main content
16,011,647 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have textarea Control in my aspx page like below:
XML
<body>
    <form id="form1"  runat="server">
    <div>
    <textarea id="write"  runat="server" cols="40" rows="6" readonly="readonly"></textarea>
    </div>
    <asp:Button ID="hi" Text="submit" runat="server" />
    </form>
</body>

My code behind page is like this:
C#
Employee er = new Employee { FirstName="hi" , LastName="sunny"};
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<div class="\">");
sb.Append(" FirstName="+er.FirstName);
sb.Append("<br />");
sb.Append(" LastName="+er.LastName);
sb.Append("<a href="\">snowball</a>");
sb.Append("</div>");
write.InnerText = sb.ToString();

this code is written in page load event.

I want to show formatted text in textarea control but it showing all html tag as well.
Can anyone please help me find the issue?

Thanks!
Posted
Updated 26-Apr-11 21:41pm
v2

Hi,

You have to use a text editor for your purpose. You can't put HTML content within a text area because it's displayed as-is.
http://ckeditor.com/demo[^]
OR
http://tinymce.moxiecode.com/tryit/full.php[^]

Hope this will help.
 
Share this answer
 
Comments
walterhevedeich 27-Apr-11 4:08am    
Good links. Voted 5.
Monjurul Habib 27-Apr-11 15:16pm    
nice link.my 5.
I agree with the first answer. My 5.

You may also want to use the control below.

RichTextBox user control for ASP.NET 1.1[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900