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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • COHENMARVIN@lycos.com

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

    I have code like this:
    FromRow = GridViewPlaceme ntsForDups.Sele ctedRow
    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
  • Mark Rae [MVP]

    #2
    Re: Why can't I read a date out a cell in a gridview

    <COHENMARVIN@ly cos.comwrote in message
    news:ff087d9e-93c0-4a58-a4d6-98b663b1dbcf@a1 g2000hsb.google groups.com...
    >I have code like this:
    FromRow = GridViewPlaceme ntsForDups.Sele ctedRow
    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?

    Is the date inside another control e.g. a label...?

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


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • COHENMARVIN@lycos.com

      #3
      Re: Why can't I read a date out a cell in a gridview

      On Jun 19, 4:28 pm, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
      <COHENMAR...@ly cos.comwrote in message
      >
      news:ff087d9e-93c0-4a58-a4d6-98b663b1dbcf@a1 g2000hsb.google groups.com...
      >
      I have code like this:
      FromRow = GridViewPlaceme ntsForDups.Sele ctedRow
      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?
      >
      Is the date inside another control e.g. a label...?
      >
      What is the value of FromRow.Cells(4 ).Controls.Coun t?
      >
      --
      Mark Rae
      ASP.NET MVPhttp://www.markrae.net
      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

      Comment

      Working...