GridView Dynamic Column

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top