Solved

PageRequestManagerServerErrorException: Conversion from string to type 'Date' is not valid

Posted on 2010-09-13
4
1,525 Views
Last Modified: 2012-05-10
hello,

I am having some real trouble with this one.  I have an aspx 3.5 page that submits a record to a backend sql server 2008 database.  When I test this page on my local testing server for asp with a real connection to the live database everything works.  But once i copy the file to the live website and try to insert the record from the live aspx file i get the following error:

  Sys.WebForms.PageRequestManagerServerErrorException: Conversion from string "14/09/2010" to type 'Date' is not valid

internet explorer debugger shows that the error is being thrown in the following code from the microsoft ajax on the line "finally {"
// Name:        MicrosoftAjax.debug.js
// Assembly:    System.Web.Extensions
// Version:     3.5.0.0
// FileVersion: 3.5.30729.196
//-----------------------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------
// MicrosoftAjax.js
// Microsoft AJAX Framework.


//other code removed to keep this short
Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() {
    /// <summary locid="M:J#Sys.Net.XMLHttpExecutor.#ctor" />
    if (arguments.length !== 0) throw Error.parameterCount();
    Sys.Net.XMLHttpExecutor.initializeBase(this);
    var _this = this;
    this._xmlHttpRequest = null;
    this._webRequest = null;
    this._responseAvailable = false;
    this._timedOut = false;
    this._timer = null;
    this._aborted = false;
    this._started = false;
    this._onReadyStateChange = (function () {
        
        if (_this._xmlHttpRequest.readyState === 4 ) {
            try {
                if (typeof(_this._xmlHttpRequest.status) === "undefined") {
                    return;
                }
            }
            catch(ex) {
                return;
            }
            
            _this._clearTimer();
            _this._responseAvailable = true;
            try {
                _this._webRequest.completed(Sys.EventArgs.Empty);
            }
            finally {
                if (_this._xmlHttpRequest != null) {
                    _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
                    _this._xmlHttpRequest = null;
                }
            }
        }
    });
    this._clearTimer = (function() {
        if (_this._timer != null) {
            window.clearTimeout(_this._timer);
            _this._timer = null;
        }
    });
    this._onTimeout = (function() {
        if (!_this._responseAvailable) {
            _this._clearTimer();
            _this._timedOut = true;
            _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
            _this._xmlHttpRequest.abort();
            _this._webRequest.completed(Sys.EventArgs.Empty);
            _this._xmlHttpRequest = null;
        }
    });
}

Open in new window


I have no idea what the above code is doing as I don't know java script and this is the last problem I have to fix before I can make the site live for my clients.

Any help at all is greatly appreciated
0
Comment
Question by:jordanking
  • 2
4 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 33666714
Seems issue with date formats used on server...say if it is default to mm/dd/yyyy, 14/09/2010 will be an invalid date. To see if this is the issue try 09/14/2010 or other format.
similar discussion here:
http://www.eggheadcafe.com/community/aspnet/7/55819/conversion-from-string-24041967-to-type-date.aspx
0
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 33666734
1.  This involves date format issues.  Something on your test system is formatting dates differently from on your production system.  Not sure whether it's the web server, the client, or the DB server.  Good thing you tested w/ 2010-09-14 not 2010-09-09 ... or either format would work and you'd break a few days later in production!

2.  I *strongly* suspect the actual error above is on line 40 even though the debugger makes it appear that it's 42.

3.  Assuming #2, the solution is not in the JavaScript, but in either the VB or the SQL.  As far as I'm concerned, that's good news, as I barely know JavaScript either.

4. The error message is a SQL Server error message.  I've seen it many times ... though it's being reported by sys.webforms.page...  that's actually coming from SQL server.

So ... when _this._webRequest.completed happens ... what's the VB.Net that's being called?  I'm guessing a Page_Load somewhere ... but could be mistaken.
0
 
LVL 1

Author Closing Comment

by:jordanking
ID: 33666906
Thanks DanielWilson,

You were right, the error was in the an event of the vb.aspx page(ServerValidate for a custom validator), but i could not see the error.  

The date textbox in question was located within an update panel so after some searching I found that if I added the following ( EnablePartialRendering="false") to the  for the update panel it threw the actual error and gave me the offending code in the ServerValidate event.  It was a simple error of passing an invalid date string to a cdate() function.  All fixed and working.
0
 
LVL 1

Author Comment

by:jordanking
ID: 33666912
this is the forum where i found the help:
http://forums.asp.net/t/1347757.aspx
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Icons and Colors for Terms 3 24
Split in Javascript 5 31
Allow user to hide and show datagridview columns 4 17
Crystal reports vb.net 2 20
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now