AJAX client script bug with validator

A

Andrew Jocelyn

Hi

I'm getting a Javascript error when I move my development application to a
production server. I have an page with an UpdatePanel and a RadioButton
which switches between a TextBox or a FileUpload control both with
validators. On the development server the validators work correctly but when
I move the app to a production server the validators don't behave correctly.
The button click event incorrectly fires the validator for the TextBox
control when the UpdatePanel has switched to the FileUpload control.

The script error is

'null' is null or not an object.

which is raised here (>>>):

function ValidatorGetValue(id) {
var control;
control = document.getElementById(id);return control.value;
}
return ValidatorGetValueRecursive(control);
}

I notice that the production web page has missing Javascript. The
development version renders a script block with
Sys.Application.initialize(); and additional script like this:

document.getElementById('ctl00_ContentPlaceHolder1_TitleRequiredFieldValidator1').dispose
= function() {
Array.remove(Page_Validators,
document.getElementById('ctl00_ContentPlaceHolder1_TitleRequiredFieldValidator1'));
}

These 'document.getElementById...' lines for the page validators are missing
from the production version.

I have carefully checked that the web.config file contains the same config
sections and httpmodules etc.

It seems that the production server must have something missing or
incorrectly configured but I'm not sure what this can be. Please let me know
what I can do to fix it.

Many thanks
Andrew
 
W

Walter Wang [MSFT]

Hi Andrew,

I suggest use Fiddler (http://www.fiddlertool.com/) to trace the requests
to the web site on your production server, it may help us to know if
there's any scripts failed to download to client.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Andrew Jocelyn

Hi Walter

I've installed Fiddler and checked the responses. A request successfully
downloads these resources.

http://.../ScriptResource.axd?d=p54...v0alfxiWSvqeCoXVoeMUtT80&t=633382414949993750

http://.../ScriptResource.axd?d=p54...sOAIDYPFoHrH0pU1FJ5WGbA2&t=633382414949993750

However, the problem seems to be that the application is not rendering the
script blocks in the aspx page the same as it is on the development machine.
So the server-side code behaves differently on the production server
compared to the development machine. The only difference I know of between
the 2 servers it that the System.Web.Extensions.dll is registered with the
GAC on the dev machine but is copied to the BIN folder on the production
server. Also the production server has never had any previous versions of
AJAX related dlls installed.

Any ideas?

Thanks
Andrew
 
M

marss

The only difference I know of between
the 2 servers it that the System.Web.Extensions.dll is registered with the
GAC on the dev machine but is copied to the BIN folder on the production
server. Also the production server has never had any previous versions of
AJAX related dlls installed.


Just a few assumptions without pretension to strict accuracy :)

In web.config you set reference for file the System.Web.Extensions.dll
as
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>

It works fine if you have this dll installed in GAC because it is
installed in "v1.0.61025" folder and it is considered as a file
version. But on your development server the application looks through
its Bin folder and finds file System.Web.Extensions.dll which file
version is ... 1.0.61231.0 (it is the real file version for this
dll).

Possible solutions:
1. Change reference for the dll from GAC to a local file in Bin folder
and recompile the project.
2. Remove additional info from web.config, just leave <add
assembly="System.Web.Extensions"/>
I don't even know what is worse :)

It is just an assumption, I am not sure whether I am right.

Regards,
Mykola
http://marss.co.ua - Casual ideas for web development
 
A

Andrew Jocelyn

Hi

Thanks for your suggestions. Actually, I have now installed the
System.Web.Extensions into the GAC on the
production server.

The problem remained. I checked to see what windows updates were available
and saw there is a .Net Framework 2.0 SP1. I've installed it and now the
application on the production server works correctly.

The release notes for ASP.NET 2.0 AJAX Extensions don't say that you need to
install this service pack, only Visual Studio 2005 SP1, which you obviously
don't install on a production server.

Oh well, it's working now.
Thanks
Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top