I am getting this error trying to dynamically added a column to my DataGrid.
I have the following code:
Function CreateBoundColumn(c as DataColumn) as DataGridColumn
Dim column as DataGridColumn = new BoundColumn()
column.DataField = c.ColumnName <----
the error
column.HeaderText = c.ColumnName.Replace("_"," ")
column.DataFormatString =setFormating(c)
return column
End Function
But the code I borrrowed this from was:
'add bound columns to the datagrid
Dim datagridcol As New BoundColumn
datagridcol.HeaderText = "Candy Type"
datagridcol.DataField = "CandyType"
DataGrid1.Columns.Add(datagridcol)
Here they use DataField the same as I do.
Am I missing something to make this work?
Thanks,
Tom
Sherif Elmetainy - 29 Aug 2007 07:34 GMT
Dim column as BoundColumn = new BoundColumn()
column.DataField = c.ColumnName
>I am getting this error trying to dynamically added a column to my
>DataGrid.
[quoted text clipped - 25 lines]
>
> Tom
tshad - 29 Aug 2007 17:47 GMT
> Dim column as BoundColumn = new BoundColumn()
> column.DataField = c.ColumnName
That was it.
I don't know how I missed that.
Thanks,
Tom
>>I am getting this error trying to dynamically added a column to my
>>DataGrid.
[quoted text clipped - 25 lines]
>>
>> Tom