Solved

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do you do a one to many list in .NET CORE? 2 24
Modal Popup Extender control 1 18
get row value in vb.net 4 14
vb.net class 3 11
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

13 Experts available now in Live!

Get 1:1 Help Now