J
Jon Edney
In ASP.NET v2.0, I can successfully bind a generic datagrid to a 1 dimensional
array. But, now I want to customise the column header. I think I need to
make the first column (the one having data in the array) a "BoundColumn" and
set the HeaderText property, but the problem is that the BoundColumn wants
a DataField name. There is none! So how do I bind this one column to the
array column when the array doesn't have column names?
Example
=======
Code
----
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim test() As String = New String() {"one", "two", "three", "four","five"}
Me.DataGrid1.DataSource = test
Me.DataGrid1.DataBind()
End Sub
Results
-------
Item
one
two
three
four
five
It looks like the column name "Item" should work... but it doesn't!
Thanks,
Jon.
array. But, now I want to customise the column header. I think I need to
make the first column (the one having data in the array) a "BoundColumn" and
set the HeaderText property, but the problem is that the BoundColumn wants
a DataField name. There is none! So how do I bind this one column to the
array column when the array doesn't have column names?
Example
=======
Code
----
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim test() As String = New String() {"one", "two", "three", "four","five"}
Me.DataGrid1.DataSource = test
Me.DataGrid1.DataBind()
End Sub
Results
-------
Item
one
two
three
four
five
It looks like the column name "Item" should work... but it doesn't!
Thanks,
Jon.