jonathan_hills
asked on
C# dialogwin.win is null or not an object
Hi
When i try and call a java script from C# like this,
this.webBrowser1.Document. Window.Fra mes["Right Pane"].Doc ument.Invo keScript(" addFilePop Up", new object[] {"20092","20057"} );. I get an dialogwin.win is null or not an object. See attached file. I have also included the html file. Any Ideas???
Cheers
a.jpg
Developer-Tools---http---usmovsa.htm
When i try and call a java script from C# like this,
this.webBrowser1.Document.
Cheers
a.jpg
Developer-Tools---http---usmovsa.htm
ASKER
Hi
Attached is the function that causes the error. I marked line 598. How do I make sure the code is executed before I make a call to the server code?
// Generate a modal dialog.
// Parameters:
// url -- URL of the page/frameset to be loaded into dialog
// width -- pixel width of the dialog window
// height -- pixel height of the dialog window
// target -- window name where to load
// scrollbars -- include scrollbars in window?
// isResizable -- is window resizable?
function openModalDialog(url, width, height, target, scrollbars, isResizable, isExternal, status)
{
dialogWin = new Object()
// Initialize properties of the modal dialog object.
dialogWin.returnedValue = ""
dialogWin.url = url
dialogWin.width = width
dialogWin.height = height
var external = false ;
if ( typeof(isExternal) != "undefined" && isExternal != null )
external = isExternal;
if ( scrollbars == null || !scrollbars )
dialogWin.scrollbars = 0
else if ( scrollbars == "true" )
dialogWin.scrollbars = "yes"
else
dialogWin.scrollbars = scrollbars
if ( isResizable == null || isResizable )
dialogWin.resizable = "yes"
else if (!isResizable || isResizable == "false")
dialogWin.resizable = "no"
else
dialogWin.resizable = isResizable
if ( status == null || !status )
dialogWin.status = "no";
else if ( status == "true" )
dialogWin.status = "yes";
else
dialogWin.status = status;
// Keep name unique so Navigator doesn't overwrite an existing dialog.
dialogWin.name = target
if ( target == "" || !target )
dialogWin.name = (new Date()).getSeconds().toStr ing()
// Assemble window attributes and try to center the dialog.
if (Nav) {
// center in screen.
dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2)
dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2)
var attr = "screenX=" + dialogWin.left + ",screenY=" + dialogWin.top
attr += ",width=" + dialogWin.width + ",height=" + dialogWin.height + ",resizable=" + dialogWin.resizable + ",scrollbars=" + dialogWin.scrollbars + ",status=" + dialogWin.status
} else {
// center in screen.
dialogWin.left = (screen.width - dialogWin.width) / 2
dialogWin.top = (screen.height - dialogWin.height) / 2
var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top
attr += ",width=" + dialogWin.width + ",height=" + dialogWin.height + ",resizable=" + dialogWin.resizable + ",scrollbars=" + dialogWin.scrollbars + ",status=" + dialogWin.status
}
if (dialogWin.url == null || dialogWin.url== ""){
var frm = getForm('');
var objurl = "";
if(frm) {
if(frm.objid && frm.classid && frm.tabid) {
objurl = "?objid="+frm.objid.value+ "&classid= "+frm.clas sid.value+ "&tabid="+ frm.tabid. value;
}
}
if(objurl.length > 0) {
dialogWin.url = "PopupLoading.jsp"+objurl;
} else {
dialogWin.url = "PopupLoading.jsp";
}
}
// Generate the dialog and make sure it has focus.
dialogWin.win = window.open(dialogWin.url, dialogWin.name, attr)
// need these for Solaris
if (typeof is_sun == "undefined") is_sun = (navigator.userAgent.toLow erCase().i ndexOf("su nos")!=-1) ;
if ( is_sun && dialogWin.win && !external)
{
dialogWin.win.resizeTo(dia logWin.wid th,dialogW in.height) ;
dialogWin.win.moveTo(dialo gWin.left, dialogWin. top);
}
Line 598 dialogWin.win.focus()
}
Attached is the function that causes the error. I marked line 598. How do I make sure the code is executed before I make a call to the server code?
// Generate a modal dialog.
// Parameters:
// url -- URL of the page/frameset to be loaded into dialog
// width -- pixel width of the dialog window
// height -- pixel height of the dialog window
// target -- window name where to load
// scrollbars -- include scrollbars in window?
// isResizable -- is window resizable?
function openModalDialog(url, width, height, target, scrollbars, isResizable, isExternal, status)
{
dialogWin = new Object()
// Initialize properties of the modal dialog object.
dialogWin.returnedValue = ""
dialogWin.url = url
dialogWin.width = width
dialogWin.height = height
var external = false ;
if ( typeof(isExternal) != "undefined" && isExternal != null )
external = isExternal;
if ( scrollbars == null || !scrollbars )
dialogWin.scrollbars = 0
else if ( scrollbars == "true" )
dialogWin.scrollbars = "yes"
else
dialogWin.scrollbars = scrollbars
if ( isResizable == null || isResizable )
dialogWin.resizable = "yes"
else if (!isResizable || isResizable == "false")
dialogWin.resizable = "no"
else
dialogWin.resizable = isResizable
if ( status == null || !status )
dialogWin.status = "no";
else if ( status == "true" )
dialogWin.status = "yes";
else
dialogWin.status = status;
// Keep name unique so Navigator doesn't overwrite an existing dialog.
dialogWin.name = target
if ( target == "" || !target )
dialogWin.name = (new Date()).getSeconds().toStr
// Assemble window attributes and try to center the dialog.
if (Nav) {
// center in screen.
dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2)
dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2)
var attr = "screenX=" + dialogWin.left + ",screenY=" + dialogWin.top
attr += ",width=" + dialogWin.width + ",height=" + dialogWin.height + ",resizable=" + dialogWin.resizable + ",scrollbars=" + dialogWin.scrollbars + ",status=" + dialogWin.status
} else {
// center in screen.
dialogWin.left = (screen.width - dialogWin.width) / 2
dialogWin.top = (screen.height - dialogWin.height) / 2
var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top
attr += ",width=" + dialogWin.width + ",height=" + dialogWin.height + ",resizable=" + dialogWin.resizable + ",scrollbars=" + dialogWin.scrollbars + ",status=" + dialogWin.status
}
if (dialogWin.url == null || dialogWin.url== ""){
var frm = getForm('');
var objurl = "";
if(frm) {
if(frm.objid && frm.classid && frm.tabid) {
objurl = "?objid="+frm.objid.value+
}
}
if(objurl.length > 0) {
dialogWin.url = "PopupLoading.jsp"+objurl;
} else {
dialogWin.url = "PopupLoading.jsp";
}
}
// Generate the dialog and make sure it has focus.
dialogWin.win = window.open(dialogWin.url,
// need these for Solaris
if (typeof is_sun == "undefined") is_sun = (navigator.userAgent.toLow
if ( is_sun && dialogWin.win && !external)
{
dialogWin.win.resizeTo(dia
dialogWin.win.moveTo(dialo
}
Line 598 dialogWin.win.focus()
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not enough info on howe t o solve issue
You should check that 598 line on your FormasLib.js file and seek where dialogWin object is loaded, maybe the code where that object is defined is not being executed when you make the call from server code.