width of column in DataGrid remains the same

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

I'm using a DataGrid (in a Webform) for which I create custom-columns.

BoundColumn organizationCol = new BoundColumn();
organizationCol.HeaderText = "Organization";
organizationCol.DataField = m_hashTable[strOrganization].ToString();
organizationCol.ItemStyle.Width = 50;
dataGrid1.Columns.Add(organizationCol);

OK, correct values are shown whe n I run the app but the only thing that is
not correct is the width of the column.

The width of the column is always set to length of the Headertext, no matter
what value I set 'organizationCol.ItemStyle.Width' to.

So
organizationCol.ItemStyle.Width = 100;
organizationCol.ItemStyle.Width = 500;
...
the width always remains the same (width of the headerText)

How can I solve this ? I want the width of my column to be set to the value
I choose.

Thnx

Chris
 
the width of a column in a html table (what the grid control generates), is
the width of widest column. set the width on the header also, and specify an
overflow style or it won't make any difference.

-- bruce (sqlwork.com)
 
Back
Top