Click here to Skip to main content
15,921,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a textbox for user text entry. Default asp textbox seems not containing carriage return or pharagraphs. How can it be done? In web project VS I could not find richtextbox too (not sure if richtextbox would work).

Kind Regards.
Posted
Updated 28-Dec-10 8:28am
v2

Do you have the TextMode property set to MultiLine?
 
Share this answer
 
Comments
AAndrews 28-Dec-10 14:06pm    
Yes. For example i enter following text.

Example sentence1.
Example sentence2.

It is shown as:
Example sentence1. Example sentence2. (not same format with entry)

Texboxt sends the text to sql table. A simple column field varchar(100).
Sergey Alexandrovich Kryukov 28-Dec-10 23:55pm    
Marc, I just credited you for this answer. I provided correct answer for both System.Windows.Forms and WPF, but people pointed out the question was about ASP.NET, then I tried to test ASP.NET, and Multiline happened to solve the problem.

Thank you!
For System.Windows.Forms or WPF:

C#
myTextBox.AcceptsReturn = true;


ASP.NET:

Set TextMode to Multiline
 
Share this answer
 
v3
Comments
Manfred Rudolf Bihy 28-Dec-10 15:04pm    
OP said "In web project VS I could not ...", and that I'd guess makes it ASP.NET instead. :)
AAndrews 28-Dec-10 15:07pm    
I guess asp: textboxes have not that property.
That comment textbox is example. When we enter a sentence it is shown same format. Default asp textboxes does not contain line breaks i guess.
Sergey Alexandrovich Kryukov 28-Dec-10 15:55pm    
Oops!
But I don't believe there is no solution. Let's see... where we put our CodeProject comments is a textarea...
AAndrews 28-Dec-10 18:15pm    
I could not resolve with textarea too. Some topics about that issue mentions to manually read incoming textbox text string to replace escape sequence and related sequences with relevant html tags. Somehow its another issue that keeping the text entries in sql with html tags. Another side i am not sure if gridview will recognize <br> tags to present a string in boundfield.

Kind Regards,
Sergey Alexandrovich Kryukov 28-Dec-10 18:22pm    
I tried to use Multiline -- it works. You have an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900