Javascript inconsistency in Postback code

R

rrichard

Hello,

I have the (apparently) same ASP .NET ASPX page running on two different
servers. I have checked the framework versions, and they are the same. (both
2.1.21022). I have a drop down listbox control that in the selected index
changed handler populates another drop down list box with data. On one server
it works, and the other I get a javascript error "Invalid character."

Upon viewing the source when the page is rendered, I noticed that on the
server which WORKS, the code looks like this:

<script language="javascript" type="text/javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Form1;
}
else {
theform = document.forms["Form1"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->

On the page that fails, it looks like this:

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>

The only thing I can think is we are missing something with the versions
here?Please advise, and thanks in advance.
 
S

Scott M.

The JavaScript that is rendered by the ASP .NET engine is supposed to be
tailored to the client making the request as well as the server that is
serving the data.

Just because you have the same version of the Framework on two servers does
not mean that the two server environments are the same.

-Scott
 

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

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top