Form Query and GridView for ASP.NET 2.0

Discussion in 'ASP .Net Datagrid Control' started by dm1608, Feb 18, 2006.

  1. dm1608

    dm1608 Guest

    Hi all --

    I'm rapidly learning ASP.NET 2.0 (never really did much .NET before...
    mainly an ASP and PHP guy until now) and seem to be having some technical
    challenges that I'm hoping someone can help me with.

    I've created an n-tier application that consists of a Business Access Lay
    and a Data Access Layer to query a SQL Server database. The classes are
    stored within my App_Code directory.

    The application is a rewrite of one of my earlier ASP applications where I
    have a form that a user selects various checkboxes and dropdown lists and/or
    types in a text string that will query a database and return all rows that
    match that criteria.

    One of the changes that I'm making is adding Peter Blum's DataTextBox
    controls for a "Start" and "End" date prompt to be used to filter records by
    date.

    The issue that I'm having is that for some reason, when a user enters a date
    such as "02/18/2005" and Peter's DateTextBox.Text property shows
    "02/18/2005" and this is the property that I bound my ObjectDataSource to
    for the GridView that I'm using. When the date gets passed to my BAL, it is
    showing as "02/18/2005 12:00:00 AM". I've tried changing the data type of
    the "StartDate" variable to be of type string instead of DateTime and I'm
    still getting the same results.

    This is causing me issues because if the user wants to query all rows for
    today, the StartDate will be 02/18/2005 12:00:00 AM and the EndDate will
    also be 02/18/2005 12:00:00 AM which causes no rows to be returned.

    I want to somehow get rid of the time and add it to my DAL's SQL
    statement... to use 12:00:00 AM for the start time and 23:59:59 for the end
    time.

    Has anyone else experienced these sort of issues before.

    I have even tried changing all my references to StartDate and EndDate to be
    of type string... Howver, when I try and do an Add() method to my generic
    collection, an exception is thrown about not being able to convert a
    DateTime type to a string type; even though I typed-casted the field to a
    string.

    Any help would this would be appreciated.
    dm1608, Feb 18, 2006
    #1
    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. dm1608
    Replies:
    1
    Views:
    814
    Otis Mukinfus
    Feb 19, 2006
  2. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,964
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  3. Ellie
    Replies:
    2
    Views:
    449
    Ellie
    Oct 30, 2008
  4. Eric Nelson
    Replies:
    5
    Views:
    1,526
    Alexey Smirnov
    Feb 4, 2009
  5. Roland Hall

    ASP LIKE query using parameterized query

    Roland Hall, Jan 12, 2007, in forum: ASP General
    Replies:
    8
    Views:
    222
    Roland Hall
    Jan 13, 2007
Loading...

Share This Page