Solved

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

Posted on 2010-09-13
4
1,601 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

687 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