Error during page display

I am rewriting a Web Application that utilizes GoView to create either org charts or flow charts, depending on what type of object the user wants to view. The environmnet is somewhat complex, as I have a page (display.aspx) that utilizes a MasterPage, and loads a control (element.ascx) that conditionally loads either a flow chart (chartFlow.ascx) or an org chart (chartOrg.ascx) user control. These user controls are wrappers for the GoView objects.
display.aspx has a placeholder called “plcHldr”. In the codebehind file for display.aspx, I have code that dynamically loads element.ascx, like this:
Control ctrl = LoadControl(“element.ascx”);
plcHldr.Controls.Add(ctrl);
element.ascx contains a placeholder element called “hldrElement”. In the element.ascx.cs codebehind file I have code that will conditionally create an orgchart or a flowchart. I am working with the orgchart control right now, and it is created like this:
Control orgChart = LoadControl(“chartOrg.ascx”);
… using refelction, call the InitializeOrgChart method I defined, and set properties …
hldrElement.Controls.Add(orgChart);
This code all seems to work, with no error. But, there is an error when the display.aspx page is displayed in the browser…
I get the “Microsoft JScript runtime error: Object expected” on the following section of code:

<img src=“GoWebImage.axd?GoView=5abf814875464cedb3e653c74ff40f86&gp=1”
id=“ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1”
name=“ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1”
width=“800”
height=“285”
onmousedown=“goMouseDown(event,‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’)”
onmouseup=“goMouseUp(event,‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’)”
ondblclick=“goDblClick(event,‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’)”
onmousemove=“goMouseMove(event,‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’)”
oncontextmenu=“return false"
onload=“goInit(‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’,‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’,‘5abf814875464cedb3e653c74ff40f86’,true,‘GoWebImage.axd’,’’,(typeof goview_ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1==‘undefined’?null:goview_ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1),true,1)”
onerror=“goLoadError(‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’)”
title=”"
alt=“Orgizational Chart”
galleryimg=“no”
/>

Specifically, this line is the cause:
onerror=“goLoadError(‘ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1’)”
the text within the quotation marks is highlighted in the debugger.

If I disable the addition of the orgChart control, all other controls are added, and the page displays without error. I have compared the page that is erroring with the page source from a previous version of this application, and I can’t see an obvious difference that might cause this error. I have confirmed that the ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1 control exists, nested within the placeholders, etc. So, I am not sure what to do next in order to debug the problem. The code block that creates the GoView object is at the bottom of the page, as it is in the working example. The code starts like this:


<!--
var goview_ctl00$ContentPlaceHolder1$ctl00$orgChart$GoView1 = new Object();
...blah blah blah...
Can you suggest a possible cause for this problem? Thank you for any advice you can give.

I solved the problem.

The control was not pointing to the GoWeb.js file correctly.
Thanks.