473,382 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to turn wrapping off for datagrid columns

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
2 1871
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrzej Kaczmarczyk | last post by:
Hi I am experiencing something weird. maybe you could help me. I have two ineditable classes from outsource libraries: DataColumn and GridColumn I have built a wrapper class around...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: rodchar | last post by:
Hey all, I have a datagrid that auto-generate the columns. When I run the app some of the column values are wrapping. How do I prevent the values from wrapping? Do I have to use template...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
2
by: TB | last post by:
According to Microsoft ( http://support.microsoft.com/default.aspx?scid=kb;EN-US;323169 ), there is bug in the the datagrid control, causing content to wrap in the columns of a datagrid eventhough...
7
by: Arpan | last post by:
Assume that a database table has the following 4 columns - ID, UserID, Subject & Marks. I am retrieving the records existing in this DB table & displaying them in a DataGrid like this: <script...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.