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

  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. 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. wh1974
    Replies:
    1
    Views:
    1,603
    =?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,461
    =?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:
    7,741
    Walter Wang [MSFT]
    Jun 20, 2006
  4. vpravin
    Replies:
    5
    Views:
    434
  5. Jonathan
    Replies:
    1
    Views:
    722
    David Wier
    Feb 18, 2008
Loading...

Share This Page