Mr_Shaw
asked on
Gridview - Index was out of range.
I have a gridview which I have populated using
Gridview1.DataSource = DataSet1;
Gridview1.databind();
when I run the following code
Gridview.Columns[4].ItemSt yle.Width = 100;
I get an error saying Index was out of range.
I just don't understand as column 4 exists.
Gridview1.DataSource = DataSet1;
Gridview1.databind();
when I run the following code
Gridview.Columns[4].ItemSt
I get an error saying Index was out of range.
I just don't understand as column 4 exists.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the code which worked was
if (e.Row.RowType == DataControlRowType.DataRow )
{
e.Row.Cells[4].Width = 500;
}
if (e.Row.RowType == DataControlRowType.DataRow
{
e.Row.Cells[4].Width = 500;
}
ASKER