Click to See Complete Forum and Search --> : resize data grid columns for best fit


xargon
October 14th, 2003, 06:03 AM
Hi everyone,

I have an ASP.NET datagrid question. How can I programatically set the datagrid columns to do an auto-fit. I basically want to bind the data and make sure that the columns resize according to the longest data field.

Thanks a bunch,

Xargon

BMeister
October 21st, 2003, 06:10 AM
Have you tried not setting a width for the column and then setting the Wrap property of the column to false i.e. if noWrapColumn is your DataGrid column

noWrapColumn.ItemStyle.Wrap = false;

Cheers,

BMeister