how do I show newline breakline in textbox as well as label in C# strictly
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
Textbox1.text="firstSentence" + System.Environment.Newline + "secondsentence" results in
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
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).
MCSD, ASP.NET MVP
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.
for the textbox try this
textbox1.text = "firstSentence" + "\r\n" + "Second sentence";
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
"Code, Beer and Music" that's my way of being a programmer!
How to get your Forum Question Answered | Blog | CodeASP.NET