Y
Yin99
I have a Gridview binding to a DataTable source. I'd like to set the
column with of the second column. I cannot do this apparently because
when AutoGenerateColumns=true, they do not appear in the columns
collection.
I modified the RowCreated even to gridview, and I can change
properties on the cells, but not width. (setting tooltip, background
color, etc, all work but changing width has no effect). Here's
sample code I am using:
//Inside RowCreated Gridview Even
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell tCell in e.Row.Cells)
{
tCell.ControlStyle.Width = 600; //no effect
tCell.Width = 600; //no effect
}
}
So the main question is, "Any way possible to change Gridview Column
Width with a DataTable source and AutoGenerateColumns=true?" Please
Help, I am at a loss here and been working on this for days....
-Yin
PS
little more background- I have a dynamic DataTable (could be 1 to
over 3000 columns), so I must have AutoGenerateColumns=true (I can't
set it to false, and create a boundfield for an unknown dynamic sized
table).
column with of the second column. I cannot do this apparently because
when AutoGenerateColumns=true, they do not appear in the columns
collection.
I modified the RowCreated even to gridview, and I can change
properties on the cells, but not width. (setting tooltip, background
color, etc, all work but changing width has no effect). Here's
sample code I am using:
//Inside RowCreated Gridview Even
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell tCell in e.Row.Cells)
{
tCell.ControlStyle.Width = 600; //no effect
tCell.Width = 600; //no effect
}
}
So the main question is, "Any way possible to change Gridview Column
Width with a DataTable source and AutoGenerateColumns=true?" Please
Help, I am at a loss here and been working on this for days....
-Yin
PS
little more background- I have a dynamic DataTable (could be 1 to
over 3000 columns), so I must have AutoGenerateColumns=true (I can't
set it to false, and create a boundfield for an unknown dynamic sized
table).