Keiko08
asked on
Textbox formatting in ASP.Net C# Javascript
Hello EE,
On a website I am working on I built a comment system that works great, except when the user submits their comment it loses all formatting, example, you can press Enter or Return in the textarea and it starts a new line, but when the insert into the database happens there is no new line so the comments are being displayed goofy, where the user presses enter there is no space or anything.
Can I do anything to resolve this without having to monitor every key stroke in the textarea?
Thanks in Advance!
On a website I am working on I built a comment system that works great, except when the user submits their comment it loses all formatting, example, you can press Enter or Return in the textarea and it starts a new line, but when the insert into the database happens there is no new line so the comments are being displayed goofy, where the user presses enter there is no space or anything.
Can I do anything to resolve this without having to monitor every key stroke in the textarea?
Thanks in Advance!
ASKER
Woops I completely misworded that, I meant a textarea, doesn't seem to be working for the textarea, I am sending the contents of the textarea using a querystring (ajax)
Hello
Try this if i understand ur problem well
textarea.text = Server.HtmlDecode(Request. QueryStrin g("stringn ame"))
neeraj523
Try this if i understand ur problem well
textarea.text = Server.HtmlDecode(Request.
neeraj523
What pratima suggested will work for a textarea as well
use this.
Supposing u have one label where u want to show data named lblText.
tempVar is variable holding database column value.
VB code
lblText.Text = tempVar.Replace(vbCrLf, "<br />")
Supposing u have one label where u want to show data named lblText.
tempVar is variable holding database column value.
VB code
lblText.Text = tempVar.Replace(vbCrLf, "<br />")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
variable.Replace(System.En
Or
variable.Replace("\n", "<br>")