473,383 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Passing parameters to gridview

I am entering two dates into textboxes and using them as control
parameters in an SQL DataSource which is being used to populate a
gridview. I am using a custom validator to check if the data entered
into the text boxes are valid dates, but even when my code captures that
they are not valid dates it seems like it still tries to populate the
gridview and in doing so gives me the error 'Conversion failed when
converting datetime from character string'.

How can I prevent these parameters being passed to the gridview if they
are invalid?
*** Sent via Developersdex http://www.developersdex.com ***
Oct 22 '07 #1
3 2474
Is enable client script set to true on your validator?

"Mike P" wrote:
I am entering two dates into textboxes and using them as control
parameters in an SQL DataSource which is being used to populate a
gridview. I am using a custom validator to check if the data entered
into the text boxes are valid dates, but even when my code captures that
they are not valid dates it seems like it still tries to populate the
gridview and in doing so gives me the error 'Conversion failed when
converting datetime from character string'.

How can I prevent these parameters being passed to the gridview if they
are invalid?
*** Sent via Developersdex http://www.developersdex.com ***
Oct 22 '07 #2
No, EnableClientScript is not set to true.

*** Sent via Developersdex http://www.developersdex.com ***
Oct 23 '07 #3
On Mon, 22 Oct 2007 07:14:42 -0700, Mike P <mi*******@gmail.com>
wrote:
>I am entering two dates into textboxes and using them as control
parameters in an SQL DataSource which is being used to populate a
gridview. I am using a custom validator to check if the data entered
into the text boxes are valid dates, but even when my code captures that
they are not valid dates it seems like it still tries to populate the
gridview and in doing so gives me the error 'Conversion failed when
converting datetime from character string'.

How can I prevent these parameters being passed to the gridview if they
are invalid?
*** Sent via Developersdex http://www.developersdex.com ***
Rather than wrestling with date validation I suggest you get a good
JavaScript calendar implementation that will save you from the
headaches of validation of dates and internationalization data format
issues.

As for your problem maybe if you posted the code that processes the
dates we could be better placed to understand the error

--
http://bytes.thinkersroom.com
Oct 23 '07 #4

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
1
by: Dotnet Gruven | last post by:
I've posted this in the adonet group, however it was suggested I might have better luck here.... ============================================================= I'm trying to use a typed dataset and...
6
by: miky | last post by:
Hi, I'm trying to get custom gridview paging working and I'm getting the following error: "ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'count' that has parameters:...
0
by: dawg1998 | last post by:
I am able to populate a DropDownList control within multiple rows of a GridView with the following code: `````````````````````````````````````````````````````` <asp:GridView id="gvGridView"...
2
by: | last post by:
I want to know how to make a clickable button or Command field on a GridView, and have the user's action a) fire a function and b) pass a data value from one of the GridView's columns to that...
14
by: joey.powell | last post by:
I am using VS2005 for a windows forms application. I need to be able to use a worker thread function to offload some processing from the UI thread. The worker thread will need access to a...
1
by: H5N1 | last post by:
Hello I'm displaying report on a gridview through object data source which gets some parameters from ddl controls. Using sql profiler I've found out that even when controls are not yet set (by...
4
by: Ken Fine | last post by:
I'm making an administrative interface that lists records in a GridView. For *each* row in the gridview, I would there to be two interface elements in addition to some information associated with...
2
by: Jeff | last post by:
hi asp.net 2.0 I have a gridview which I'm trying to update a row within. When I click on the Update button, my website crash. It displays a webpage saying that a parameter is missing. So I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.