Best way to handle dates in a gridview?

Discussion in 'ASP .Net' started by trevi, Nov 27, 2007.

  1. trevi

    trevi Guest

    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.
     
    trevi, Nov 27, 2007
    #1
    1. Advertising

  2. 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.
     
    bruce barker (sqlwork.com), Nov 27, 2007
    #2
    1. Advertising

  3. trevi

    trevi Guest

    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.
     
    trevi, Nov 27, 2007
    #3
  4. trevi

    trevi Guest

    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.
     
    trevi, Nov 27, 2007
    #4
  5. trevi

    trevi Guest

    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.
     
    trevi, Nov 27, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    875
    Rob Schieber
    Sep 30, 2005
  2. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    201
    Mark Schupp
    Aug 9, 2004
  3. Replies:
    1
    Views:
    207
    Jano Svitok
    Jul 17, 2007
  4. kellygreer1

    RFC-822 dates into Ruby dates

    kellygreer1, Jun 8, 2008, in forum: Ruby
    Replies:
    1
    Views:
    205
    Eric I.
    Jun 8, 2008
  5. Dr J R Stockton

    FAQ Dates; Opera Dates.

    Dr J R Stockton, Jun 18, 2007, in forum: Javascript
    Replies:
    0
    Views:
    163
    Dr J R Stockton
    Jun 18, 2007
Loading...

Share This Page