user710502
user710502

Reputation: 11471

How to Preserve Formatting in a Multi-Line Text Box

I have a website where I create a textbox multi-line at runtime depending on some selections for example, they specify the number of lines and the width, then I create the textbox and put it in a panel on the next page. My issue is that in the textbox they would like to write something like this:

   Company Name
   123 Test Avenue
   New York, NY 10001

I would like to preserve the formatting, what i mean by this is keeping the next lines as a block, right now if they entered it like that in the textbox it would show like this:

Company Name 123 Test Avenue New York, NY 10001

Is there a way at all to do this with <asp:TextBox/> multi-line ?.

Upvotes: 1

Views: 3590

Answers (1)

Amir
Amir

Reputation: 9627

You need to use a control like ckeditor . (Rich text editors for asp.net)

TextArea (asp:textbox with mode="multiline") does not save the formatting, which in your case is <br/>

To persist the rich text into the database you need to think of possible problem in advance.

How to save HTML data in Sql Server

how to save html to a database field

http://forums.asp.net/t/1669475.aspx/1

Upvotes: 1

Related Questions