Murray Brown
asked on
ASP.net change header text of GridView template columns
Hi. I am trying to change the header text of template columns in a GridView in ASP.net using the following VB.net code but for some reason the
headers are not changing
headers are not changing
Private Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound
For i As Integer = 0 To UBound(arrDates)
oColIndex = i + 2
oTemplateColumn = "D" & CStr(i + 1)
oEachDate = CDate(arrDates(i))
oDate = oEachDate.ToString("dd MMM yyyy")
Me.GridView1.Columns(oColIndex).Visible = True
If e.Row.RowType = DataControlRowType.Header Then
Me.GridView1.Columns(oColIndex).HeaderText = oDate
End If
End if
Ebd Sub
ASKER
sorry missed the word "not"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You do not need to write this code inside gridview rowdatabound. You can write it after your code to gridview1.DataBind();
Open in new window