autosize a label

G

Guest

i need to autosize a label to grow with the size of the text that from a
database
how do i do this?
i have tried to uses MeasureString but i don't have the right parameters
namely the font parameters. asp uses fontinfo class and Measurestring dose
not take that input.
 
M

Mark Fitzpatrick

The label doesn't need to be sized at all. Keep in mind though, the label
will only fill whatever container it's in. If the label control is in a
table cell that is only 100 pixels wide, it will wrap within that table cell
because it's container is restricting it. Make sure you don't put height and
width values on it and you should be fine as far as the label itself goes.
You just have to be very careful about what it is going into.
 
B

bruce barker

as the server may not have the same font or font sizes as the browser,
you can not do this server side. you can only do it client side, but
there is no string measure, you can only check actual rendered size.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top