Best way to handle dates in a gridview?

T

trevi

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.
 
B

bruce barker (sqlwork.com)

I's store null in the database and use blank in the list.

-- bruce (sqlwork.com)
 
T

trevi

I think that's probably better. Thanks Bruce.
bruce barker (sqlwork.com) said:
I's store null in the database and use blank in the list.

-- bruce (sqlwork.com)
 
T

trevi

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-
 
T

trevi

I found an article where it says you can use 'optional' parameters. that part
seems to work. It just caused problems with other areas :( ........
 

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,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top