473,608 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.showModa lDialog() works perfect, but returning to parent-page doesnot

Hi there,

programming with Visual Studio 2005 and ASP.NET 2.0 I want to open a modal
dialog from Default.aspx.
I searched the net and many newsgroups but I couldn't find any solution.

First I tried using two aspx pages with standard controls and all those
post-backs and their attributes OnClientClick. Since this didn't work, i
reduced it to a default.aspx page opening a pure html-page as a modal
dialog.

On the second form I am using a input control of type "submit" and a little
client side script "Sub Submit1_onclick " which sets the return value and
calls "window.close() ". But instead of closing the modal dialog and
returning to the caller window, it opens a new internet explorer instance
showing the same controls as the modal dialog window. Very annoying!

All I can do to close the modal dialog is clicking the white cross on the
red background in the right corner of the dialog's window. This will close
the dialog and return to the caller's window but has several drawbacks: the
return value gets lost and the user cannot choose between Ok and Cancel.

Here's my code:
======== Default.aspx =============== =============== =======
<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="Defau lt.aspx.vb"
Inherits="_Defa ult" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<meta content="text/VBScript" http-equiv="content-script-type" />
<title>Main Page</title>
<script language="vbscr ipt" type="text/vbscript">

Sub Button2_onclick
Dim Result 'as string
Result = window.showModa lDialog("Standa rdHtmlPage.htm" ,
"","help:no;sta tus:no;unadorne d:yes")
window.alert("D ialog Result = '" & Result & "'")
End Sub

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
The Main Page - please choose a command<br />
&nbsp;<input id="Button2" type="button" value="HTML page with
Standard HTML-controls" />

</div>
</form>
</body>
</html>

======== StandardHtmlPag e.htm =============== =============== =======
<%@ Page Language="VB" AutoEventWireup ="false"
CodeFile="Stand ardHtmlDialog.a spx.vb" Inherits="Stand ardHtmlDialog" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta content="text/VBScript" http-equiv="content-script-type" />
<title>No ASP.NET!</title>
<script language="vbscr ipt" type="text/vbscript">

Sub Submit1_onclick
' Problem: window.close() führt vom Dialog zu neuem IE-Fesnter mit
gleichem Inhalt aber Menuzeile etc.
window.returnVa lue = "say hello from dialog"
window.alert("o nclick returns '" & window.returnVa lue & "'")
window.close()
End Sub

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
A pure HTML-page with HTML-controls only<br />
<input id="Text1" type="text"/><input id="Submit1" type="submit"
value="submit"/>
</div>
</form>
</body>
</html>
Sep 22 '06 #1
1 7649
Hi,

it seems that I found a solution: in the form which is opened as modal
dialog you have to add a <base target="_self" />-tag to the <headsection
as shown in the following example:

<head runat="server">
<!-- <base href="_self" /-->
<base target="_self"/>
....
</head>

I read in another newsgroup, that until ASP.NET 1.1 you could achive the
same result with the tag <base href="_self" />. I didn't check this, but
this solution does not work any longer with ASP.NET 2.0. Therefore you have
to use the target-attribute.

Hope this helps anyone with a similar problem.

Curious Trigger

"Curious Trigger" <Cu************ *@nospam.gmx.ne tschrieb im Newsbeitrag
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi there,

programming with Visual Studio 2005 and ASP.NET 2.0 I want to open a modal
dialog from Default.aspx.
I searched the net and many newsgroups but I couldn't find any solution.

First I tried using two aspx pages with standard controls and all those
post-backs and their attributes OnClientClick. Since this didn't work, i
reduced it to a default.aspx page opening a pure html-page as a modal
dialog.

On the second form I am using a input control of type "submit" and a
little client side script "Sub Submit1_onclick " which sets the return
value and calls "window.close() ". But instead of closing the modal dialog
and returning to the caller window, it opens a new internet explorer
instance showing the same controls as the modal dialog window. Very
annoying!

All I can do to close the modal dialog is clicking the white cross on the
red background in the right corner of the dialog's window. This will close
the dialog and return to the caller's window but has several drawbacks:
the return value gets lost and the user cannot choose between Ok and
Cancel.

Here's my code:
======== Default.aspx =============== =============== =======
<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="Defau lt.aspx.vb"
Inherits="_Defa ult" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<meta content="text/VBScript" http-equiv="content-script-type" />
<title>Main Page</title>
<script language="vbscr ipt" type="text/vbscript">

Sub Button2_onclick
Dim Result 'as string
Result = window.showModa lDialog("Standa rdHtmlPage.htm" ,
"","help:no;sta tus:no;unadorne d:yes")
window.alert("D ialog Result = '" & Result & "'")
End Sub

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
The Main Page - please choose a command<br />
&nbsp;<input id="Button2" type="button" value="HTML page with
Standard HTML-controls" />

</div>
</form>
</body>
</html>

======== StandardHtmlPag e.htm =============== =============== =======
<%@ Page Language="VB" AutoEventWireup ="false"
CodeFile="Stand ardHtmlDialog.a spx.vb" Inherits="Stand ardHtmlDialog" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta content="text/VBScript" http-equiv="content-script-type" />
<title>No ASP.NET!</title>
<script language="vbscr ipt" type="text/vbscript">

Sub Submit1_onclick
' Problem: window.close() führt vom Dialog zu neuem IE-Fesnter mit
gleichem Inhalt aber Menuzeile etc.
window.returnVa lue = "say hello from dialog"
window.alert("o nclick returns '" & window.returnVa lue & "'")
window.close()
End Sub

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
A pure HTML-page with HTML-controls only<br />
<input id="Text1" type="text"/><input id="Submit1" type="submit"
value="submit"/>
</div>
</form>
</body>
</html>


Sep 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8168
by: Lee | last post by:
I am using a modal window and an iFrame to try and pull a return value back. I am doing this across domains. I have the value returned from the modal window to the iFrame window but I can not get the value returned to the parent window. The alert in the parent window always returns undefined errors. Any help would be much appreciated. I call the modal window and wait for the return as such: function LCC()
4
7551
by: Simon Wigzell | last post by:
I have a couple of utility windows - a calculator and a calendar that popup from my main window. I would like them to always stay in front of the parent window until they are shut down with there own close buttons. As it is, when you click back to the parent window, of course it comes in front of the child windows. Can I do this?
4
3733
by: webdev | last post by:
Hi, I have an application built for the education market in which I open popup windows containing ASP scripts which when the user clicks the 'Update' button, the database is updated and the window loads a confirmation message along with a 'Close this window' link. All has gone well in the early stages of testing, but I've now come across a problem where a number (a considerable number) of users seem to be incapable of clicking in the...
2
1368
by: Namespace | last post by:
Hi I am having a problem with opening a new browser window through a client-side javascript (window.open/_blank) function. The window do "pop up" but behind the window where I pushed the "pop up" button. It works ofcause with the window.showModalDialog method but then postback causes another window to pop up, so I'm back to the window.open method. How can I set foucs on the new pop-up window from the parent browser window?
0
1476
by: prakash2kr | last post by:
i am using the following code to show popup window window.showModalDialog("WebForm2.aspx","","height=200px;width=300px"); how can i pass the value from WebForm2.aspx to parent window... i had already tried the following code it was not working
1
2709
by: elizayiu | last post by:
Hi, I need to write a webpage which does the following: - open up a window and pass parameters into it (i.e. need to call showModalDialog() or showModelessDialog()) - contains jscript to support drag and drop objects from itself to the popup window - wait for user response in popup window and return results back to the parent window (i.e. calling showModalDialog() is preferred)
1
1461
by: CutCopyPaste | last post by:
Hi , I am trying to open a modal window but if t he window is already opened i need to just set the focus back . The Code is working fine in one environment but not live system on live system every time a window gets opened irrespective of an existing window. What i Assume is that htp.p(' function disp() {'); htp.p(' MyTimeOutWin = window.open("", "TimeOut")'); htp.p(' if (window.MyTimeOutWin) {');
1
4484
by: Ramachand | last post by:
Actually I have to call a dialog window "Dwin1" from a Parent Window. From Dwin1, I have to call another Dialog Window "Dwin2".if user close the Dialog Window "Dwin2", i have to refersh the Dwin1. If user close Dwin1, i have to refresh the Parent Window. For opening a Dwin1 , should not be a problem.but if i open the another dialog Dwin2 from Dwin1, it's opening like a seperate window Dwin1 . From there it's opening the Dialog Open Dwin1...
1
1777
by: varunvashishth | last post by:
hi, I'm facing a problem with displaying a child jsp on top of parent jsp. on clicking a link in parent jsp the child jsp opens up and it has some list of values and other textboxes which gets populated from the cache. child has ok and cancel buttons. my requirement is that as long as child window is active (ie, you havent clicked ok or cancel or closed the window otherwise), user should not be able to do any processing on parent. ...
0
8057
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8329
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3959
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4022
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1327
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.