Problem with a modal dialog box called with VB

J

Jeff

I'm hoping that someone can help me. I know little javascript and only need
a very small amount in a visual web 2005 application using vb. I'm not sure
whether my problem is related to the java or to the vb, but I'm thinking
that it may likely be the vb.

I'm attempting to open a java modal dialog box from a parent window. I have
most of the dialog box working with one problem. The dialog box opens fine
with the code below associated with the parent. In the child window, I have
a button with the simple self.close()
code associated with it. Obviously, I want to use the button to close the
child window (I've also tried window.close()). When the button is clicked,
the dialog box closes, but the info.aspx page is then re-displayed in
another regular window that opens. I found some reference to the problem on
the web with an explanation that it only occurs in IE after version 5, but
I've found no solution. ...and it still occurs in both IE6 and IE7.

Can someone tell me what I'm missing?

In parent window
Button1.OnClientClick = ("window.showModalDialog('Info.aspx','
','dialogHeight:150px,dialogWidth:200px');")

In the child window
Button1.OnClientClick = ("self.close();")

Thanks in advance

Jeff
 
L

Luke Zhang [MSFT]

Hello Jeff,

I build a similar sample with two ASPX pages, but I didn't find same issue.
Is it possible that the info.aspx was reopened by some other code in your
application? For example, the close event of info.aspx, or some other code
in parent window?

Here is code I used:

parent.aspx:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="button"
onclick="window.showModalDialog('Info.aspx','','dialogHeight:150px,dialogWid
th:200px'); " />
</div>
</form>
</body>
</html>


Info.aspx:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="info.aspx.vb"
Inherits="info" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="button" onclick
="self.close();" />
</div>
</form>
</body>
</html>


Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jeff

Luke Zhang said:
Hello Jeff,

I build a similar sample with two ASPX pages, but I didn't find same
issue.
Is it possible that the info.aspx was reopened by some other code in your
application? For example, the close event of info.aspx, or some other code
in parent window?

I finally found the problem and you were close. I was experimenting with
different code and had some javascript hidden in the aspx source code that
was causing the problem.

Thanks

Jeff
 
L

Luke Zhang [MSFT]

Hello,

Any update on this issue? Has the problem been resolved?

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Top