June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to insert line breaks in the text of a Web control such as the Label control.
Add HTML markup to the string. For example, you can use <p> to denote paragraphs or <br> to divide a line.
You can’t use the carriage return character (or the System.Environment.Newline constant) to insert a line break in the text of a Web control. Instead, you must use HTML tags. For example, the following code snippet creates three lines of text:
lblMessage.Text = "This is line one.<br>" lblMessage.Text &= "This is line two.<br>" lblMessage.Text &= "This is line three."
Figure 15-4 shows the use of multiple lines in a Web control.
Figure 15-4. Multiple lines in a label.
Read now
Unlock full access