473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
Jun 27 '08 #1
2 943
<CO*********@lycos.comwrote in message
news:ff**********************************@a1g2000h sb.googlegroups.com...
>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 MVP
http://www.markrae.net

Jun 27 '08 #2
On Jun 19, 4:28 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
<COHENMAR...@lycos.comwrote in message

news:ff**********************************@a1g2000h sb.googlegroups.com...
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
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data...
11
by: Jo | last post by:
Hi all, I have a gridview displaying a dataset and some buttons. When a certain cell of this datasetrow is empty, I want a button in that row to be visible, otherwise no button should be shown...
1
by: Haleigh | last post by:
How do I set the cell/field of a gridview to be read only when in edit mode. Is it possible to use ISREADONLY. I only see this to check the state of a cell, but not to change the cell to be TRUE...
3
by: Bill Gower | last post by:
I have an cell which contains a field member which is filled with String.Empty. When I retrieve the value in the cell with Cells.Text.ToString() and try to compare it to String.Empty, I can't...
4
by: Steve Kershaw | last post by:
Hi, I have a gridview with an UpdateQuery() that's fired when the user edits/updates a row. The problem lies in the fact that every cell in the edited row shows up as editable even though one...
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
5
by: mohaaron | last post by:
OK, I have now gone through lots of posts, and there are lots, looking for a anwer as to why I can't set the width of the columns in my gridview. So far I have tried the following methods to set...
2
by: Bart | last post by:
Hi, i need to check wether a cell of a gridview is empty or not. I did this: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
4
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.