Debugger Issue

  • Thread starter Thread starter RM
  • Start date Start date
R

RM

I have a page that a .NET control on it. On onLoad I call a JavaScript
function that makes calls to methods in this control to initialize it. This
works fine if I just open the URL in a browser. However, if I try to run
the project from within the debuggerI get a JavaScript error stating that
the object does not support this method. Since it works outside the
debugger I know that this may have something to do with the creation of the
control.

The code looks something like the following:

<%@ Page language="c#" Codebehind="Navigation.aspx.cs"
AutoEventWireup="false" Inherits="MedusaReport.Reports.Navigation" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Navigation</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="functions.js"/>
function InitializeNavControl()
{
navigatorControl.SetServer(UIControlParameters[0],
UIControlParameters[1], UIControlParameters[2]);
navigatorControl.SetConfigurationFile(UIControlParameters[3]);
navigatorControl.SetPostTarget(UIControlParameters[4]);
navigatorControl.attachEvent("OnReportRequest",handleEvent);
}
</SCRIPT>
</HEAD>
<BODY MS_POSITIONING="GridLayout" onload="InitializeNavControl()">
<OBJECT id="navigatorControl" style="LEFT: 0px; TOP: 0px"
classid="aaWebClient.dll#WebClient.aaNavigatorControl"
VIEWASTEXT>
</OBJECT>
<form id="Form1" method="post" runat="server">
&nbsp;
</form>
</BODY>
</HTML>
 
onload is too early to call InitializeNavControl(). onload fires after the
page has been rendered, but before any objects are necessarily loaded (as
this is done by a seperate thread). after all the download of the control
may take minutes (or the user may abort the download). you need to wait for
the readyState to equal 4. javascript (unless fired by a control event)
should never access an object without first checking the readyState.

function InitializeNavControl()
{
// if not ready, try agin later

if (navigatorControl.readyState != 4)
{
window.setTimeout("InitializeNavControl()",10);
return;
}


navigatorControl.SetServer(UIControlParameters[0],UIControlParameters[1],
UIControlParameters[2]);
navigatorControl.SetConfigurationFile(UIControlParameters[3]);
navigatorControl.SetPostTarget(UIControlParameters[4]);
navigatorControl.attachEvent("OnReportRequest",handleEvent);
}



| I have a page that a .NET control on it. On onLoad I call a JavaScript
| function that makes calls to methods in this control to initialize it.
This
| works fine if I just open the URL in a browser. However, if I try to run
| the project from within the debuggerI get a JavaScript error stating that
| the object does not support this method. Since it works outside the
| debugger I know that this may have something to do with the creation of
the
| control.
|
| The code looks something like the following:
|
| <%@ Page language="c#" Codebehind="Navigation.aspx.cs"
| AutoEventWireup="false" Inherits="MedusaReport.Reports.Navigation" %>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
| <HTML>
| <HEAD>
| <title>Navigation</title>
| <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
| <meta name="CODE_LANGUAGE" Content="C#">
| <meta name="vs_defaultClientScript" content="JavaScript">
| <meta name="vs_targetSchema"
| content="http://schemas.microsoft.com/intellisense/ie5">
| <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"
SRC="functions.js"/>
| function InitializeNavControl()
| {
| navigatorControl.SetServer(UIControlParameters[0],
| UIControlParameters[1], UIControlParameters[2]);
| navigatorControl.SetConfigurationFile(UIControlParameters[3]);
| navigatorControl.SetPostTarget(UIControlParameters[4]);
| navigatorControl.attachEvent("OnReportRequest",handleEvent);
| }
| </SCRIPT>
| </HEAD>
| <BODY MS_POSITIONING="GridLayout" onload="InitializeNavControl()">
| <OBJECT id="navigatorControl" style="LEFT: 0px; TOP: 0px"
| classid="aaWebClient.dll#WebClient.aaNavigatorControl"
| VIEWASTEXT>
| </OBJECT>
| <form id="Form1" method="post" runat="server">
| &nbsp;
| </form>
| </BODY>
| </HTML>
|
|
 
Back
Top