-
Datagrid Column Header
I have a Datagrid that I'm binding a dataset to, however I need to rename a couple column Headers(template columns) at run-time, based upon user interaction..
Datagrid1.Columns(1).HeaderText = "Heading #1"
Datagrid1.Columns(2).HeaderText = "Heading #2"
looks like it should work, but doesn't.
anybody have any solutions?
-
I think you are trying to address the datagrid directly itself rather than the datagridtable style, here is an example of my own code which may help.
Dim ts1 As New DataGridTableStyle()
ts1.MappingName = "Properties"
' Add Property
Dim o1 As New DataGridTextBoxColumn()
o1.MappingName = "Property"
o1.Width = 0
ts1.GridColumnStyles.Add(o1)
' Add First line of Address
Dim o2 As New DataGridTextBoxColumn()
o2.MappingName = "Adr1"
o2.HeaderText = " First Line of Address"
o2.Width = 160
o2.NullText = ""
ts1.GridColumnStyles.Add(o2)