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

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
 
C

COHENMARVIN

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
 

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

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top