Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Why can't I read a date out a cell in a gridview

Reply
Thread Tools

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

 
 
COHENMARVIN@lycos.com
Guest
Posts: n/a
 
      06-19-2008
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
 
Reply With Quote
 
 
 
 
COHENMARVIN@lycos.com
Guest
Posts: n/a
 
      06-20-2008
On Jun 19, 4:28 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> <COHENMAR...@lycos.com> wrote in message
>
> news:ff087d9e-93c0-4a58-a4d6-...
>
> >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?

>
> Is the date inside another control e.g. a label...?
>
> What is the value of FromRow.Cells(4).Controls.Count?
>
> --
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
Making a GridView Cell read-only aljamala@gmail.com ASP .Net Web Controls 1 12-19-2006 05:06 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57