width of column in DataGrid remains the same

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top