Solved

Assigning multiline to label

Posted on 2006-11-08
5
1,270 Views
Last Modified: 2008-01-09
Hi

I’m fairly new to ASP.NET, I’m using 2.0.

 I am trying to develop a page where the user can enter text into a multi line textbox and then when they click enter the text is stored in a Table in an SQLServer DB.

When the page is reloaded the text that was stored is outputted to a Label.

This works ok except for one small problem when I enter text in the text box which is more than one line IE

"Hello
my
name
is
Graham"

It is displayed in the Label as "Hello my name is Graham"

Does anyone know how to keep the text in the form that it was entered in the textbox when it is displayed in the Label?

Other wise I will not be able to have paragraphs etc, just one long string.

Thanks

0
Comment
Question by:amoran
5 Comments
 
LVL 15

Accepted Solution

by:
mattisflones earned 20 total points
ID: 17897407
The input in a textbox is string, thus displayed as a string when you retrieve the data back.
The linebreaks you see in the textbox are not really there.. call it a malfunck if you want.

One option for handling this is a messy Jscript code, that will not work on lots of browsers, to search your textbox for newlines on submit, but thats a bad solution..

What you need is a wysiwyg editor, that alter your input with <br> tags and so forth, and even allows for real "MSWord" like texthandling..
I can suggest the same editor that i use in all my projects; FredCKs FCKeditor.
http://www.fckeditor.net/
(Be sure to get the ASP.NET addpack aswell as the editor itself! Works like a charm in VS and VSExpress)

Its to say it in one word.. Devine! :-)
0
 
LVL 3

Expert Comment

by:rugu_16
ID: 17900378
No need to do anything. If you want lable to work as multiline then just give fix width like and then lable will contain as many words as it can
and then append at the bottom.

so if u r lable has width = 50px
then "Hello my name is Graham"
will look like

"Hello my name
is Graham"

Rugved
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question