?
Solved

changing the __doPostBack javascript

Posted on 2003-04-01
5
Medium Priority
?
3,039 Views
Last Modified: 2011-09-20
Hi all,

review of the problem:

The site I'm working on uses some templating system that force the <form> to a second level in the control tree, so the name and id of my form are not
<form name="myForm" id="myForm">
but
<form name="_ctl0:myForm" id="_ctl0_myForm">

The problem is with netscape, the __doPostBack generated is
     function __doPostBack(eventTarget, eventArgument) {
          var theform = document._ctl0_myForm;
          theform.__EVENTTARGET.value = eventTarget;
          theform.__EVENTARGUMENT.value = eventArgument;
          theform.submit();
     }

which failed in netscape (both 4 and 6)! In fact the document._ctl0_myForm is null. Netscape is for sure looking the names and not the ids to find the object.

During some investigation (hard to find any information related to that problem), I discovered the http://www.asp.net have another __doPostBack script! Here it is:

     function __doPostBack(eventTarget, eventArgument) {
          var theform;
          if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
               theform = document.forms["frmDefault"];
          }
          else {
               theform = document.frmDefault;
          }
          theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
          theform.__EVENTARGUMENT.value = eventArgument;
          theform.submit();
     }

The line with the eventTarget.split("$").join(":") is not related; they changed the default : separator with a $ on the pages (why?).

But what is important is the theForm assignation. I then tried to RegisterClientScriptBlock with that script:
     function __doPostBack(eventTarget, eventArgument) {
          var theform;
          if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
               theform = document.forms["_ctl0_myForm"];
          }
          else {
               theform = document._ctl0_myForm
          }
          theform.__EVENTTARGET.value = eventTarget;
          theform.__EVENTARGUMENT.value = eventArgument;
          theform.submit();
     }

And it 'fixed' my problem but it gives in the page the following code:
<script language="javascript">
<!--
     function __doPostBack(eventTarget, eventArgument) {
          var theform = document._ctl0_myForm;
          theform.__EVENTTARGET.value = eventTarget;
          theform.__EVENTARGUMENT.value = eventArgument;
          theform.submit();
     }
// -->
</script>
<script language="javascript">
<!--
     function __doPostBack(eventTarget, eventArgument) {
          var theform;
          if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
               theform = document.forms["_ctl0_myForm"];
          }
          else {
               theform = document._ctl0_myForm
          }
          theform.__EVENTTARGET.value = eventTarget;
          theform.__EVENTARGUMENT.value = eventArgument;
          theform.submit();
     }
// -->
</script>

The standard __doPostBack followed with my script registration that 'replace' the default one.

I would like to know if there is another way to fix this problem ?
Is there any way to access that __doPostBack script to change it?

/tharn
0
Comment
Question by:TharnJaggar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 8

Expert Comment

by:Zlatin Zlatev
ID: 8245138
Another option is to override page render method like in:
http://www.dotnet247.com/247reference/msgs/29/147381.aspx
0
 
LVL 8

Expert Comment

by:Zlatin Zlatev
ID: 8245184
Ensure that you have the latest SP (dot NET 1.0 SP2) of .NET Framework
0
 
LVL 8

Expert Comment

by:Zlatin Zlatev
ID: 8245192
check here for a solution:
http://www.15seconds.com/issue/030303.htm
0
 
LVL 8

Accepted Solution

by:
Zlatin Zlatev earned 300 total points
ID: 8245338
0
 
LVL 1

Author Comment

by:TharnJaggar
ID: 8246843
The KB is exactely my problem.
Thanks zlatev.

Note: SP2 does not fix the problem. Strange because the KB is related to SP1 so we could think the patch was added to SP2.

/tharn
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

765 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