How to turn wrapping off for datagrid columns

Discussion in 'ASP .Net' started by Scott, Jan 7, 2004.

  1. Scott

    Scott Guest

    I having a problem where I need to turn off the wrapping feature for
    all columns in my datagrid. Example code would be:

    <asp:DataGrid id="ResultGrid" runat="server"
    AutoGenerateColumns="true">
    <ItemStyle Wrap="false"></ItemStyle>
    <Columns>
    </Columns>
    </asp:DataGrid>

    I understand the above code does not turn the wrapping feature off on
    the <td> level, but only the <tr> level which is not what I want. I
    also understand that this is a Microsoft bug and in order to fix it, I
    have to add the asp:BoundColumn along with the ItemStyle
    (wrap="false") for each column. While this is ok if you know what the
    columns are going to be, but in my case I'm dynamically building
    columns based on what table in the database the user has chosen. So I
    don't know what the columns will be or how many.

    Has anybody come across this and if you have, can you give me some
    hints or examples which would allow me to turn wrapping off for all
    columns.

    Thanks.
     
    Scott, Jan 7, 2004
    #1
    1. Advertising

  2. Have your tried a style sheet?
    A
    "Scott" <> wrote in message
    news:...
    > I having a problem where I need to turn off the wrapping feature for
    > all columns in my datagrid. Example code would be:
    >
    > <asp:DataGrid id="ResultGrid" runat="server"
    > AutoGenerateColumns="true">
    > <ItemStyle Wrap="false"></ItemStyle>
    > <Columns>
    > </Columns>
    > </asp:DataGrid>
    >
    > I understand the above code does not turn the wrapping feature off on
    > the <td> level, but only the <tr> level which is not what I want. I
    > also understand that this is a Microsoft bug and in order to fix it, I
    > have to add the asp:BoundColumn along with the ItemStyle
    > (wrap="false") for each column. While this is ok if you know what the
    > columns are going to be, but in my case I'm dynamically building
    > columns based on what table in the database the user has chosen. So I
    > don't know what the columns will be or how many.
    >
    > Has anybody come across this and if you have, can you give me some
    > hints or examples which would allow me to turn wrapping off for all
    > columns.
    >
    > Thanks.
     
    Andrew de la Harpe, Jan 8, 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. Kevin Spencer
    Replies:
    2
    Views:
    485
    Cheung, Jeffrey Jing-Yen
    Jul 8, 2003
  2. Andy Crawford

    How to turn Strict "off"?

    Andy Crawford, Jul 10, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    543
    Cowboy \(Gregory A. Beamer\)
    Jul 11, 2003
  3. =?Utf-8?B?cm9kY2hhcg==?=

    datagrid columns wrapping

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    746
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 22, 2004
  4. robert112
    Replies:
    1
    Views:
    467
    Juan T. Llibre
    Apr 26, 2007
  5. TJ

    how to turn off DataGrid header

    TJ, Oct 31, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    112
    Elton Wang
    Oct 31, 2005
Loading...

Share This Page