Hi All,
how do I show newline breakline in textbox as well as label in C# strictly
for example:
label1.text = "firstSentence<bR>Second sentence" resuls good with new line after "first sentence"
textbox1.text="firstSentence<bR>Second sentence" shows as it is with "<br>" tag in it.
In c# i used System.Environment.Newline
lable1.text="firstSentence" + System.Environment.Newline + "secondsentence" results in
firstsentence secondsentnece.
Textbox1.text="firstSentence" + System.Environment.Newline + "secondsentence" results in
firstsentence
secondsentece......which is good. But I am saving this message to database. So server.htmlencode is not helping as it is displaying html tag in the textbox but good in lable.
Plzzz help me .... this is bugging me a lot
Thank you all
Carol
![]() |
0 |
![]() |
Hi Carol,
The best thing I can think of is to store message to DB using any one of methods (say <br>) and execute some processing when using retrieved strings in TextBoxes (replace <br> with Enviroment.NewLine).
Leon Langleyben
MCSD, ASP.NET MVP
Blog
![]() |
0 |
![]() |
Hi Illangleyben,
Thank you. I am doing the same but the other way. As I know a particular word "In respnose to:" will be added before storing to database I am finding that word and replaceing it with "<BR>In reposen to <BR>" so that it gets displayed correctly in label too. With this I done need to worry about storing tags in DATABASE.
Thank you once again for the reply.
Carol
![]() |
0 |
![]() |
Hi,
for the textbox try this
textbox1.text = "firstSentence" + "\r\n" + "Second sentence";
Regards,
Alok
![]() |
0 |
![]() |
Use \r\n instead like
TextBox1.Tex = "A" + "\r\n" + "B";
Bu if you are trying to create newline during retrieving the values the use the Environment.NewLine
Regards,Vinz
"Code, Beer and Music" that's my way of being a programmer!
How to get your Forum Question Answered | Blog | CodeASP.NET
![]() |
0 |
![]() |