autosize a label

Discussion in 'ASP .Net' started by =?Utf-8?B?ZGFycmVu?=, Apr 19, 2007.

  1. 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.
     
    =?Utf-8?B?ZGFycmVu?=, Apr 19, 2007
    #1
    1. Advertising

  2. 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.


    --
    Hope this helps,
    Mark Fitzpatrick
    Former Microsoft FrontPage MVP 199?-2006

    "darren" <> wrote in message
    news:...
    >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.
    >
     
    Mark Fitzpatrick, Apr 19, 2007
    #2
    1. Advertising

  3. =?Utf-8?B?ZGFycmVu?=

    bruce barker Guest

    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)


    darren wrote:
    > 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.
    >
     
    bruce barker, Apr 19, 2007
    #3
  4. thanks
    i have the labels in a table, so how to i expand the table cell then?

    "Mark Fitzpatrick" wrote:

    > 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.
    >
    >
    > --
    > Hope this helps,
    > Mark Fitzpatrick
    > Former Microsoft FrontPage MVP 199?-2006
    >
    > "darren" <> wrote in message
    > news:...
    > >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.
    > >

    >
    >
    >
     
    =?Utf-8?B?ZGFycmVu?=, Apr 19, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryou kaihou
    Replies:
    1
    Views:
    423
    Eric Moreau
    Jun 14, 2007
  2. James Wong

    Autosize of label

    James Wong, Jul 12, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    910
    James Wong
    Jul 13, 2004
  3. Ryou kaihou
    Replies:
    1
    Views:
    193
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Jun 14, 2007
  4. Ryou kaihou
    Replies:
    0
    Views:
    147
    Ryou kaihou
    Jun 14, 2007
  5. Knut Krueger
    Replies:
    8
    Views:
    334
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page