By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,018 Members | 870 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,018 IT Pros & Developers. It's quick & easy.

How to turn wrapping off for datagrid columns

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Have your tried a style sheet?
A
"Scott" <sc******@hotmail.com> wrote in message
news:e6**************************@posting.google.c om...
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.

Nov 18 '05 #2

P: n/a
You know, I posted this question too quick without really thinking
Andrew and I didn't even consider CSS. I've been coding ASP for years
and I just need to shift my "set of rules" over to ASP.Net. Since my
problem was trying to turn the nowraping off on the <td> tags, I just
added the following code:

<STYLE>
td
{
FONT-SIZE: 9pt;
FONT-FAMILY: Verdana;
WHITE-SPACE: nowrap;
PADDING: 2;
}
</STYLE>

and it worked.

Thanks Andrew!

"Andrew de la Harpe" <an*********@hotmail.com> wrote in message news:<O4**************@TK2MSFTNGP12.phx.gbl>...
Have your tried a style sheet?
A
"Scott" <sc******@hotmail.com> wrote in message
news:e6**************************@posting.google.c om...
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.

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.