473,378 Members | 1,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ASP.NET Multiline Label

I have used multiline in textbox in asp.net 2.0 like below
Name :
Age:
Phone No:

Now while retriving I want to display exact same way in label.
Can anybody resolve my query
Jul 2 '08 #1
2 1871
DrBunchman
979 Expert 512MB
You can either use three labels or use a textbox and set the border property to none and the background colour to the same as the control that the textbox is sat upon.

Hope this helps,

Dr B
Jul 2 '08 #2
Frinavale
9,735 Expert Mod 8TB
If you only want to use one Label, you can insert "<br />" html tags after each line.

For Example:

Expand|Select|Wrap|Line Numbers
  1. Dim labelText As New StringBuilder
  2. labelText.Append("Age: ")
  3. labelText.Append(ageValue)
  4. labelText.Append("<br />")
  5.  
  6. labelText.Append("Name : ")
  7. labelText.Append(nameValue)
  8. labelText.Append("<br />")
  9.  
  10. labelText.Append("Phone No: ")
  11. labelText.Append(phoneNumberValue)
  12. labelText.Append("<br />")
  13.  
  14. MyLabel.Text = labelText.ToString()
  15.  
  16.  
If you want to use three Labels, make sure you set each Label to have the style "display" element set to "block". This will force the label to display as a "block" instead of "inline"...which forces each label to appear on a new line. When Labels have a style with a display of block, you can set the width of the Label and it will properly display with that width...

Eg:

Expand|Select|Wrap|Line Numbers
  1. AgeLabel.Style.Remove("display")
  2. NameLabel.Style.Remove("display")
  3. PhoneNumberLabel.Style.Remove("display")
  4.  
  5. AgeLabel.Style.Add("display","block")
  6. NameLabel.Style.Add("display","block")
  7. PhoneNumberLabel.Style.Add("display","block")
  8.  
  9. AgeLabel.Text = "Age: " + ageValue.ToString()
  10. NameLabel.Text = "Name : " + nameValue
  11. PhoneNumberLabel.Text = "Phone No: " +  phoneNumberValue
  12.  
Cheers!

-Frinny
Jul 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead...
4
by: DS | last post by:
Can anyone think of a way or point me in the right direction to be able to get a multiline treeview? By this I mean that each TreeNode Label can span say 2 lines (delimited by \n)? Thanks! -Dan
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
1
by: Olav Tollefsen | last post by:
I have a MultiLine TextBox to which I add text like this: TextBox1.Attributes.Add("style","overflow :hidden"); TextBox1.Text = "Line 1\r\nLine 2\r\nLine 3"; The number of lines added to the...
3
by: Owen Richardson | last post by:
I have read several posts regarding formatting multiline text for rendering becuase vbCrLf needs to be converted to <br/tags, and i need to do the same. My question is the best way to achieve this...
6
by: Zdenek Maxa | last post by:
Hi all, I would like to perform regular expression replace (e.g. removing everything from within tags in a XML file) with multiple-line pattern. How can I do this? where =...
1
by: bruce628 | last post by:
I want to use SWT tab compnent and make it be multiline,but I fail.please see the class TabFolderExample. Can aneone help me? import java.awt.BorderLayout; import...
5
by: vjsv2007 | last post by:
Can you help to make one alert with all details? <script type="text/javascript"> <!-- function validate_form ( ) { valid = true;
6
by: Ria12 | last post by:
Hello,kindly request you to plz help me..... I have label control in the datalist.I want to display the text in this label with line breaks....Plz help me......Thks in advance.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.