G
Guest
I'm adding a dynamic column to a gridview control at runtime but I'm
encountering a problem whereby I can only add 1 item to the column header.
The column header should show the date in the format dd/mm but I need to
store the full date (e.g. dd/mm/yyyy) in a hidden field for the column but
only the last item in code is being rendered. Can you only add 1 item to a
column?
CODE---------------------------
For i = 8 To (e.Row.Cells.Count - 1)
classDate = CType(e.Row.Cells(i).Text, Date)
classDateHidden = New HiddenField
classDateHidden.Value = classDate.ToShortDateString
e.Row.Cells(i).Controls.Add(classDateHidden)
e.Row.Cells(i).Text = String.Format("{0:dd<br />/MM}",
classDate)
Next
encountering a problem whereby I can only add 1 item to the column header.
The column header should show the date in the format dd/mm but I need to
store the full date (e.g. dd/mm/yyyy) in a hidden field for the column but
only the last item in code is being rendered. Can you only add 1 item to a
column?
CODE---------------------------
For i = 8 To (e.Row.Cells.Count - 1)
classDate = CType(e.Row.Cells(i).Text, Date)
classDateHidden = New HiddenField
classDateHidden.Value = classDate.ToShortDateString
e.Row.Cells(i).Controls.Add(classDateHidden)
e.Row.Cells(i).Text = String.Format("{0:dd<br />/MM}",
classDate)
Next