473,498 Members | 1,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best way to handle dates in a gridview?

hi,

I've got a gridviw that has fields that relate to datefields, actually I
only care about the time in these fields. I display them as drop-down lists
so user can change the date when in edit mode. My problem is that sometimes,
the user does not have to fill in a time. In this case, I am not sure what to
do. I thought of:
1. putting in some odd date I know they never will input, then maybe not
display it in the gridview... dorky.
2. putting a blank in the drop-down selection, but then I have a hard time
handling a blank for a date field.

what is the best option? I appreciate your input. thanks.
Nov 27 '07 #1
4 1244
I's store null in the database and use blank in the list.

-- bruce (sqlwork.com)
"trevi" wrote:
hi,

I've got a gridviw that has fields that relate to datefields, actually I
only care about the time in these fields. I display them as drop-down lists
so user can change the date when in edit mode. My problem is that sometimes,
the user does not have to fill in a time. In this case, I am not sure what to
do. I thought of:
1. putting in some odd date I know they never will input, then maybe not
display it in the gridview... dorky.
2. putting a blank in the drop-down selection, but then I have a hard time
handling a blank for a date field.

what is the best option? I appreciate your input. thanks.
Nov 27 '07 #2
I think that's probably better. Thanks Bruce.
"bruce barker (sqlwork.com)" wrote:
I's store null in the database and use blank in the list.

-- bruce (sqlwork.com)
"trevi" wrote:
hi,

I've got a gridviw that has fields that relate to datefields, actually I
only care about the time in these fields. I display them as drop-down lists
so user can change the date when in edit mode. My problem is that sometimes,
the user does not have to fill in a time. In this case, I am not sure what to
do. I thought of:
1. putting in some odd date I know they never will input, then maybe not
display it in the gridview... dorky.
2. putting a blank in the drop-down selection, but then I have a hard time
handling a blank for a date field.

what is the best option? I appreciate your input. thanks.
Nov 27 '07 #3
I managed to get around blank dates in the rowdatabound event, but I'm having
problems in the rowupdating event. I tried setting the field to a blank
string and of course it didn't like it. I'm updating the table with a stored
procedure. I set the fields in my code. How do I pass a parameter of blank to
a datetime field?
thanks-

"bruce barker (sqlwork.com)" wrote:
I's store null in the database and use blank in the list.

-- bruce (sqlwork.com)
"trevi" wrote:
hi,

I've got a gridviw that has fields that relate to datefields, actually I
only care about the time in these fields. I display them as drop-down lists
so user can change the date when in edit mode. My problem is that sometimes,
the user does not have to fill in a time. In this case, I am not sure what to
do. I thought of:
1. putting in some odd date I know they never will input, then maybe not
display it in the gridview... dorky.
2. putting a blank in the drop-down selection, but then I have a hard time
handling a blank for a date field.

what is the best option? I appreciate your input. thanks.
Nov 27 '07 #4
I found an article where it says you can use 'optional' parameters. that part
seems to work. It just caused problems with other areas :( ........

"trevi" wrote:
hi,

I've got a gridviw that has fields that relate to datefields, actually I
only care about the time in these fields. I display them as drop-down lists
so user can change the date when in edit mode. My problem is that sometimes,
the user does not have to fill in a time. In this case, I am not sure what to
do. I thought of:
1. putting in some odd date I know they never will input, then maybe not
display it in the gridview... dorky.
2. putting a blank in the drop-down selection, but then I have a hard time
handling a blank for a date field.

what is the best option? I appreciate your input. thanks.
Nov 27 '07 #5

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

Similar topics

3
2481
by: thechaosengine | last post by:
Hi all, I'm having trouble getting dates to display in the right format in my GridView. I'd like it to appear in the UK format - just the date, not the time, but I'm not having any luck. ...
5
19014
by: Robert W. | last post by:
My app runs perfectly when run in Canada or the U.S. But others are experiencing problems. So I switched my computer to the UK culture and immediately saw a problem. This line was failing: ...
0
1636
by: John Smith | last post by:
If anyone can help, I would very muchly appreciate it. I have a main page that uses the .net 2.0 menu control with the multiview controls as the menu choices. This works fine. One of the menu...
1
1908
by: hartbypass | last post by:
Hello all. I am trying to move data from my Gridview, essentially a dataset, to a Sql table I created. I am trying to do this without having to create a stored proc that I have to call every...
0
868
by: DC | last post by:
Hi, I want to present hirarchical data in a gridview. Each row offers a link to another data subset. When viewstate is off, I have to early rebuild the gridview just to raise the damn click...
0
870
by: mentor | last post by:
The GridView in Cotent page cause an updating event, but the handling methond won't be executed. The Row Count of the GridView is Zero, but in fact it's not zero. Why? <asp:Content...
6
5728
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
1
2567
by: =?Utf-8?B?U0g=?= | last post by:
To All, Just a guideline on the best practice for this issue. I have a number of tables in SQL, and I want to join across them and display their corresponding values in a datagrid. For example...
0
887
by: bob | last post by:
Hi, Further to my previous wailing, has ANYBODY successfully put a date into a gridview databound column and managed to retrieve it back into a variable?? If so I would love to hear about it....
0
7124
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
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.