Fixed Column Widths in DataGrid

Discussion in 'ASP .Net Web Controls' started by Alex Maghen, Dec 30, 2004.

  1. Alex Maghen

    Alex Maghen Guest

    Hi. Is there a way to configure a DataBound column (or any other column) in a
    DataGrid control so that, no matter what, it will not be wider than a certain
    number of pixels? My problem is that with some unicode text, IE can't find a
    line break so it doesn't wrap the text, it just streaches out the width of
    the column. I need it to just cut the text off in those circumstances.

    Ideas?

    Alex
     
    Alex Maghen, Dec 30, 2004
    #1
    1. Advertisements

  2. Hi Alex,

    I suspect that you're up against a limitation of HTML.

    Your best bet would be to test the content of the column when the grid item
    is bound and then trim the text to an acceptable length. You should be able
    to do this in the ItemDataBound event.

    Ken
    MVP [ASP.NET]

    "Alex Maghen" <> wrote in message
    news:...
    > Hi. Is there a way to configure a DataBound column (or any other column)
    > in a
    > DataGrid control so that, no matter what, it will not be wider than a
    > certain
    > number of pixels? My problem is that with some unicode text, IE can't find
    > a
    > line break so it doesn't wrap the text, it just streaches out the width of
    > the column. I need it to just cut the text off in those circumstances.
    >
    > Ideas?
    >
    > Alex
     
    Ken Cox [Microsoft MVP], Dec 31, 2004
    #2
    1. Advertisements

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. wh1974
    Replies:
    1
    Views:
    1,780
    =?Utf-8?B?RmVybmFuZG8gSHVudGg=?=
    Jan 11, 2005
  2. =?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,712
    =?Utf-8?B?RWxtZXI=?=
    Apr 19, 2005
  3. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    Forced Column Widths in a DataGrid?

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Jun 16, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    8,208
    Walter Wang [MSFT]
    Jun 20, 2006
  4. vpravin
    Replies:
    5
    Views:
    589
  5. Jonathan
    Replies:
    1
    Views:
    847
    David Wier
    Feb 18, 2008
  6. Davef

    Datagrid column widths

    Davef, Oct 28, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    300
    John Soulis [MSFT]
    Oct 28, 2003
  7. Andre

    DataGrid Column widths not changing - help!!!

    Andre, Sep 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    197
    Andre
    Sep 29, 2003
  8. Andre Ranieri

    DataGrid Column widths not changing - help!!!

    Andre Ranieri, Sep 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    200
    Andre Ranieri
    Sep 29, 2003
Loading...