473,657 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Query and GridView for ASP.NET 2.0

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.Tex t property shows
"02/18/2005" and this is the property that I bound my ObjectDataSourc e 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.
Feb 18 '06 #1
1 1456
On Sat, 18 Feb 2006 15:03:37 -0600, "dm1608" <dm****@spam.ne t> wrote:
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.Tex t property shows
"02/18/2005" and this is the property that I bound my ObjectDataSourc e 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.

When you get the DateTime values from the control, try this:

Assuming the date are DateTime objects:

if the End date is MM/dd/yyy 00:00:00 AM, leave it alone. Then do this: EndDate.AddHour s(24);

Now you have a date time range that includes all 24 hours of the end points.

Is that what you want?
Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
Feb 19 '06 #2

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

Similar topics

3
5673
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the GridView to allow entry of quantity and Y/N switch for
4
2675
by: Steven Blair | last post by:
I have a web form with a GridView and a DataSource. As soon as the page loads, my GridView is populated. My form has several querying capabilties, which on postback repopulates my GridView. What I want is to stop the data binding when my form first starts up, so the query components are clear and no default data is returned when the user first loads up. Is this possible and if so, how could I go about doing this?
2
3436
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3 datagrida. I would like to set it so that if value of column 3 in datagrid 1 is < 100 set to red, if = 100 set to green if value of column 3 in datagrid 2 is < 90 set to red, if >= 90 set to green if value of column 3 in datagrid 3is < 80 set to red,...
1
2615
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have a GridView which i can Page on (go to page 2,10,...) the thing is that i have a dynamic query which set the GridView from starts on page 1. the thing is that when i start to go over the pages - the dynamic query isnt saved and i cant go to the real page 4 for example of the dynamic query,rather i go to page 4 of the original basic query
3
2818
by: Max2006 | last post by:
Hi, I have a search result GridView bound to an ObjectDataSource. Once I open the asp.net page, the ObjectDataSource automatically refreshes the GridView which is the default behavior. I am trying to disable automatic query feature in ObjectDataSource, such that it query the database only when the user click on Search button. Is there anyway to prevent ObjectDataSource query the database when the page
2
2651
by: jonny | last post by:
How can I do this with ASP controls & VB.NET On click of button run query to fill gridView.
2
4716
by: frankiefrank | last post by:
I have been struggling with this issue for some time, hope someone here can help out. After facing the issue (will describe it soon) in a solution with Ajax and a Master Page I decided to try it in its most basic form: I created a new project, new aspx page with a GridView. I notice that once I create the new page the body contains a <form runat="server"> tag. I add a GridView, data comes from SQL server. I want to be able to render the...
1
974
by: vstud | last post by:
Hi guys, I have a simple page with a text box for inserting a name and a gridview below it. once the user type the name the gridview displays the matching record that has that name in the database table. all works fine so far, however when I've change the page to use a Master page layout the gridview will not display the record. (unless i have a simple select), somehow the i believe that the input text box is not read properly by the query...
5
10603
by: abutaher | last post by:
Hi, I've an asp.net .ascx form and a gridview on that form.I've placed that form on an .aspx. Now while I'm trying to import data from gridview to excel it is showing the error "Control 'GridView' must be placed inside a form tag with runat=server" I've overrides the ascx as follow : Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) MyBase.Render(writer) End Sub But still it is shwoing the same...
0
8413
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.