Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting the width of a label control

Using the Label control, the display text is set during runtime from the database. I am trying to control the maximum width of the control, for example max of 100 per line with additional characters rolled over to the next line.

I tried this by setting and also using CSS with no luck:

lbl_Feedback1.Width = 50;

I believe the issue lies with the fact that the text of the label is updated during run time of the application. How to solve this?

like image 837
Bruce Avatar asked Feb 23 '23 00:02

Bruce


1 Answers

Your label must be set to "display: block" in order to set a width. Either set this in the css-file:

label, span {
display: block
}

or using inline style (from code-behind):

lbl_Feedback1.Style["display"] = "block";
lbl_Feedback1.Style["width"] = "100px";
like image 120
hakksor Avatar answered Mar 07 '23 13:03

hakksor