G
Guest
I am trying to set the width of one of the columns of an asp.net 2.0 Gridview
control.
I am using a line -
MyGridview.Columns[2].ItemStyle.Width = Unit.Percentage(40);
The problem is that there are no columns in the gridview so this line "blows
up".
I am binding the gridview to data in code in the Page_load event. The
problem seems to be that I am trying to set the width before the creation of
the control is complete. All the examples I have seen, bind the control
directly to a database table/query and I presume that the control is then
populated earlier.
I have triedall the events in the page and the control, but without success.
Any ideas on what I am doing wrong, or how to achieve this?
Mike parris
control.
I am using a line -
MyGridview.Columns[2].ItemStyle.Width = Unit.Percentage(40);
The problem is that there are no columns in the gridview so this line "blows
up".
I am binding the gridview to data in code in the Page_load event. The
problem seems to be that I am trying to set the width before the creation of
the control is complete. All the examples I have seen, bind the control
directly to a database table/query and I presume that the control is then
populated earlier.
I have triedall the events in the page and the control, but without success.
Any ideas on what I am doing wrong, or how to achieve this?
Mike parris