Datagrid Column Width

Discussion in 'ASP .Net' started by Chris, Mar 21, 2005.

  1. Chris

    Chris Guest

    Is there a way to autosize the Datagrid column widths to just a bit larger
    than the data. I know how to manually size the column in code but I have a
    dynamically created datagrid and it work except the data is all squeezed
    together. I'd like a way to measure the text in the column and then
    increase the size a little so it's easier to read.

    Thanks
    Chris
    Chris, Mar 21, 2005
    #1
    1. Advertising

  2. Chris,

    You can simply apply padding-left and padding-right css rules to the cells.
    You can access cells in either ItemDataBound or PreRender event.

    Eliyahu

    "Chris" <> wrote in message
    news:...
    > Is there a way to autosize the Datagrid column widths to just a bit larger
    > than the data. I know how to manually size the column in code but I have

    a
    > dynamically created datagrid and it work except the data is all squeezed
    > together. I'd like a way to measure the text in the column and then
    > increase the size a little so it's easier to read.
    >
    > Thanks
    > Chris
    >
    >
    Eliyahu Goldin, Mar 21, 2005
    #2
    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. AndrewF
    Replies:
    1
    Views:
    747
    Bruce Barker
    Oct 10, 2005
  2. Charleees
    Replies:
    2
    Views:
    8,193
    Eliyahu Goldin
    Jun 20, 2006
  3. ssk
    Replies:
    5
    Views:
    5,468
    Jukka K. Korpela
    Oct 30, 2006
  4. David Basford
    Replies:
    3
    Views:
    2,394
    BootNic
    Sep 30, 2007
  5. Carl Howarth

    DG Column Width vs Table Column Width

    Carl Howarth, Oct 22, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    257
    Eliyahu Goldin
    Oct 24, 2004
Loading...

Share This Page