hi
i'm trying to dynamically add columns to my gridview control.
i tried this code:
BoundColumn col = new BoundColumn();
col.DataField = myDataTable.Columns[0].ColumnName;
col.HeaderText = "last exit time";
col.DataFormatString = "{0:mm-dd-yyyy}";
GridView1.Columns.Add(col);
the datafied property is taken from datatable which will be the source of the gridview.
the build gives me an error "cannot convert from bound column to datacontrolfield".
i tryed to create new datacontrolfield but i dont know which object to create ?
what is the right way to dynamically add bound columns to gridview ?