Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Assigning multiline to label

Posted on 2006-11-08
5
Medium Priority
?
1,276 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 80 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

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

715 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