views:

2766

answers:

1

I have a GridView control that I am dynamically creating at runtime. I am creating all the columns like this.

foreach (GridColumnConfig column in columns)
{
    BoundField boundField = new BoundField();
    boundField.HeaderText = column.Title;
    boundField.DataField = column.FieldName;
    boundField.SortExpression = column.FieldName;
    boundField.ItemStyle.Wrap = false;
    boundField.ItemStyle.Width = new Unit(column.Width, UnitType.Pixel);
    boundField.ItemStyle.HorizontalAlign = TextToAlign(column.Align);
    m_GenericListView.Grid.Columns.Add(boundField);        
}

However even though I have specified the item not to wrap text it still does so in IE6. In FireFox it just creates a very wide column which is probably not what either, even though the width has been specified.

Is there any way to really control these widths and wrapping columns in a GridView ?

A: 

The word-wrap CSS style works for me when I want to control wrapping. Here's a discussion that pretty well covers it.

http://bytes.com/forum/thread627827.html

Paul Prewett