Fixing Column Widths Permanently

Discussion in 'ASP .Net Datagrid Control' started by DarthMcAdam, Oct 14, 2005.

  1. DarthMcAdam

    DarthMcAdam Guest

    I have a datagrid that I'm using to show a list of hierarchical data,
    much like a tree-view. I won't go into the detail, suffice to say that
    the reason I'm doing this is because of the poor quality of the data
    (imported from a legacy system) and the manner in which the database
    has had to be designed to accommodate this; in no way is it ideal, but
    we have no other options but to do it this way.

    Anyhoo, when I expand each level (columns going left-to-right), I'm
    finding that if the text in the next column is wider than the
    column-width that has been set, it expands to some degree to
    accommodate the text.

    Does anyone know how I can possibly fix the widths to prevent them from
    widening/narrowing so that the surrounding columns don't 'shift' from
    right-to-left and back again?

    Just so you know, I've set the following values:
    ItemStyle-Width
    HeaderStyle-Width
    ItemStyle-CssClass (width defined in the class)

    I've also tried setting text-overflow: ellipsis, but it didn't do
    anything! A shame, since that would have been perfect. I've had
    moderate success with Style.Add("WORD-BREAK", "break-all"), but it's
    still not perfect and in any case, the results are not great.

    Any help on this would be appreciated.
    DarthMcAdam, Oct 14, 2005
    #1
    1. Advertising

  2. DarthMcAdam

    Elton Wang Guest

    One way to workaround is to trim text to fixed length and the assign whole
    text to ToolTip of the cell.

    HTH


    "DarthMcAdam" <> wrote in message
    news:...
    >I have a datagrid that I'm using to show a list of hierarchical data,
    > much like a tree-view. I won't go into the detail, suffice to say that
    > the reason I'm doing this is because of the poor quality of the data
    > (imported from a legacy system) and the manner in which the database
    > has had to be designed to accommodate this; in no way is it ideal, but
    > we have no other options but to do it this way.
    >
    > Anyhoo, when I expand each level (columns going left-to-right), I'm
    > finding that if the text in the next column is wider than the
    > column-width that has been set, it expands to some degree to
    > accommodate the text.
    >
    > Does anyone know how I can possibly fix the widths to prevent them from
    > widening/narrowing so that the surrounding columns don't 'shift' from
    > right-to-left and back again?
    >
    > Just so you know, I've set the following values:
    > ItemStyle-Width
    > HeaderStyle-Width
    > ItemStyle-CssClass (width defined in the class)
    >
    > I've also tried setting text-overflow: ellipsis, but it didn't do
    > anything! A shame, since that would have been perfect. I've had
    > moderate success with Style.Add("WORD-BREAK", "break-all"), but it's
    > still not perfect and in any case, the results are not great.
    >
    > Any help on this would be appreciated.
    >
    Elton Wang, Oct 14, 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. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    More Elegant Column Widths in ASP:Table Objects?

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, May 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    548
    Jason DeFontes
    May 14, 2004
  2. sck10

    Data Grid Column Widths

    sck10, Nov 8, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    7,714
    Steven Cheng[MSFT]
    Nov 15, 2004
  3. wh1974
    Replies:
    1
    Views:
    1,565
    =?Utf-8?B?RmVybmFuZG8gSHVudGg=?=
    Jan 11, 2005
  4. =?Utf-8?B?RWxtZXI=?=

    Datagrid column widths in edit mode

    =?Utf-8?B?RWxtZXI=?=, Apr 8, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    2,419
    =?Utf-8?B?RWxtZXI=?=
    Apr 19, 2005
  5. Alan Searle
    Replies:
    22
    Views:
    855
    Jonathan N. Little
    Oct 22, 2007
Loading...

Share This Page