Recently when I was designing an ASP.Net form I came across a strange requirement where in static text had to be displayed in multiple lines. When I looked at it looked really simple.Just have as many Label controls as the number of lines.
But then I did not want to waste multiple controls.Well...err..I tried something silly and trivial and it served the purpose.
Lets say "This is the sample text I want to display in a Label on an ASP.Net form in a project" and I want this to be displayed in multiple lines.
The silly method goes like this.
Drag and drop a Label on to the ASP.net form.
Choose the Text property for the Label in the Designer.
This is the sample text <(br)>I want to display in a Label <(br)> on an ASP.Net form in a project.
Note: Remove the brackets ( and ) which will result in adding a line break to the text.
When the page renders the label will display the above text as below
This is the sample text
I want to display in a Label
on an ASP.Net form in a project.
No comments:
Post a Comment