Saravanan
Saravanan

Reputation: 11612

how to display html text inside the textarea control in asp.net[.net 4 framework]?

I have added one submit button and one textArea control in asp.net(4 framework) page.Whenever user clicks submit button, then i will get some html text and needs to display it in the textArea control.

for example: (i) <B><I>some text</I></B> then i have to display the text with BOLD and ITALIC style in the textArea contol

(ii) Also, needs to display Html TABLE inside the textArea control.

I dont know is this possible or not...

Please guide me to get out of this issue...

Upvotes: 1

Views: 5672

Answers (4)

Saravanan
Saravanan

Reputation: 11612

We can use literal control for this requirement.

  <asp:Literal id="literal1" Text="I love ASP!" runat="server" />

In C#,

   literal1.text=htmlString;

It is working good for me...

Upvotes: 0

Ravi Vanapalli
Ravi Vanapalli

Reputation: 9950

Well you cannot display a table inside TextArea but you can surely set it's css to display text in bold & italics.

You can use textarea{ font-weight: bold; font-style:italic; }

You can use TinyMCE as mentioned by nunespascal, alternatively you can use div to look like a textarea, please check the below link.

How do I make an editable DIV look like a text field?

Upvotes: 0

Iti Tyagi
Iti Tyagi

Reputation: 3671

Textbox used in general are limited in their functionality so in order to get additional editing and features, you must go through the functionality of Richtextbox. I think this link might help: Richtextbox

Upvotes: 0

nunespascal
nunespascal

Reputation: 17724

This is not possible with the standard textarea.

You will need a rich text edit box. There are lot of editors available for this.

Take a look at

Tiny MCE

or

jQuery based CLEditor

Upvotes: 2

Related Questions