Solved

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

Posted on 2010-09-13
4
1,518 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

20 Experts available now in Live!

Get 1:1 Help Now