Link to home
Start Free TrialLog in
Avatar of jordanking
jordankingFlag for Canada

asked on

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

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
Avatar of guru_sami
guru_sami
Flag of United States of America image

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
ASKER CERTIFIED SOLUTION
Avatar of Daniel Wilson
Daniel Wilson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jordanking

ASKER

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.
this is the forum where i found the help:
http://forums.asp.net/t/1347757.aspx