Solved

Assigning multiline to label

Posted on 2006-11-08
5
1,271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# MVC Insert Multiple Row into DB 2 101
ASP.NET Content Page 3 64
Validating textboxes in red square borders. 2 43
Difference between Highcharts and Mapbox 10 45
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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 …

751 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