set formatted text to textarea

Posted by Abhi_patil under JavaScript on 2/21/2009 | Views : 3814 | Status : [Member] | Replies : 4
i hv textarea with somemsg. suppose "this is my demo".

when i click on button,
i want the same msg with same color. but only "my" should be in RED color.




Responses

Posted by: Raja on: 2/21/2009 [Member] Starter

Up
0
Down
You can find the work and replace it with html code.

Like

string str = TextBox1.Text.Replace("my", "<font color=\"red\">my</font>");

Hope this will give you some idea.

Thanks

Regards,
Raja, USA

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/22/2009 [Member] Bronze

Up
0
Down
You cannot display HTML or formated tag in the TextArea.
Reason:
An html textarea tag will not render html.. it will only show text, so your html will not be rendered in the text area, it is not designed for that.
But,
You can formate the Label text using the Method provided by Raja.

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi_patil on: 2/26/2009 [Member] Starter

Up
0
Down
i tried this but textbox contain this
"<font color=\"red\">my</font>"

as it is.

it doesnt come in red color.


Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/26/2009 [Member] Bronze

Up
0
Down
Hi Abhi,
As I have already written that you cannot format the textarea. As it does not render the HTML control. You can provide the facility of Preview in a Label to the User.

Thanks,

Abhi_patil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response