aairwaves
10-16-2006, 06:18 PM
Hi winder if you guys can help me? I have the following code:
BoundColumn col1 = new BoundColumn();
gv.DataSource = ds.Tables[0].DefaultView;
col1.HeaderText = "asdasdasdasdasdasda";
col1.DataField = "ContactName";
gv.Columns.Add(col1); // error here
gv.DataBind();
I keep getting an error on :
gv.Columns.Add(col1);
I get a error line under the gv:
"Only assignment, call, increment, decrement, and new object expressions can be used as a statement"
an an error under the col1:
"Argument '1': cannot convert from 'System.Web.UI.WebControls.BoundColumn' to 'System.Web.UI.WebControls.DataControlField'"
Any ideas as to what the problem is?
Thanks
BoundColumn col1 = new BoundColumn();
gv.DataSource = ds.Tables[0].DefaultView;
col1.HeaderText = "asdasdasdasdasdasda";
col1.DataField = "ContactName";
gv.Columns.Add(col1); // error here
gv.DataBind();
I keep getting an error on :
gv.Columns.Add(col1);
I get a error line under the gv:
"Only assignment, call, increment, decrement, and new object expressions can be used as a statement"
an an error under the col1:
"Argument '1': cannot convert from 'System.Web.UI.WebControls.BoundColumn' to 'System.Web.UI.WebControls.DataControlField'"
Any ideas as to what the problem is?
Thanks