
08-11-2006, 03:10 AM
|
 |
Junior Contributor
|
|
Join Date: Oct 2003
Location: Birmingham, England
Posts: 291
|
|
ASP.NET 2.0: GridView.Columns.Add() problem
|
Hiya,
I'm having real problems programmatically adding BoundColumns to my GridView. All the documentation and examples I can find say to use the following syntax:
Code:
BoundColumn col = new BoundColumn();
col.DataField = "Title";
col.HeaderText = "Title";
grdItems.Columns.Add(col);
However, this just gives me the build errors:
Quote:
|
The best overloaded method match for 'System.Web.UI.WebControls.DataControlFieldCollection.Add(System.Web.U I.WebControls.DataControlField)' has some invalid arguments
|
Quote:
|
Argument '1': cannot convert from 'System.Web.UI.WebControls.BoundColumn' to 'System.Web.UI.WebControls.DataControlField'
|
Ideas?
Thanks!
|
|