Why can't I read a date out a cell in a gridview

  • Thread starter Thread starter COHENMARVIN
  • Start date Start date
C

COHENMARVIN

I have code like this:
FromRow = GridViewPlacementsForDups.SelectedRow
strCellContents = FromRow.Cells(4).Text
It works fine for most of the cells in the row. But cell #4 (above)
has a date in it, and when I run the debugger, strCellContents is
blank.
Am I doing something wrong?
Thanks,
Marv
 
Is the date inside another control e.g. a label...?

What is the value of FromRow.Cells(4).Controls.Count?

I found out the problem - which is that the date is in a template
control, while the other fields of the grid are not.
(The reason I had put in a template control was to format it).
However, I also find that MSDN.microsoft.com gives wrong advice on
getting the value out of this template control. So I've given up on
that approach, and I've made the sql query return a string form of a
date that doesn't have to be put in a template control.
Thanks,
Marv
 
Back
Top