Solved

Assigning multiline to label

Posted on 2006-11-08
5
1,267 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net dynamic formulas in runtime 11 75
IIS authorization for web service or reading header data on a webservice post 1 56
Modal Popup Extender control 1 22
asp.net mvc5 6 17
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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