473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

window.showModalDialog and ASP.NET

I'm not quite sure if the problem I'm having is a restriction of
showModalDialog or if there is a way around it.

The web app I am working requires the user to select a record from a list.
I pop this list (generated by a second page) in a second window. When the
user selects a record on the datagrid, I close the second window and submit
the calling page.

If I try to use showModalDialog, the dialog pops up just fine and everything
is rendered correctly. However, as soon as the page posts back a new browser
window is opened with what appears to be the response for the post back.

Is there a way around this behavior?
Nov 18 '05 #1
3 7204
This is done by design. Soon you gonna discover that JScript window.history
doesn't exist in modal dialog, too :)
The only way around this prob is to place iFrame inside of a simple static
html page and make the source of that iframe your aspx page. Then it'll post
correctly.

For example:

Simple HTML page - /SIMPLE_HTML_PAGE.html:

<html>
<head>
<script language="javascript">
function InitFrame(){document.all.frContainer.src =
window.dialogArguments;}
</script>
</head>
<body onload="InitFrame();">
<iframe id="frContainer" frameborder="0" height="100%"
width="100%"></iframe>
</body>
</html>
JScript function (simplified) on your "base" page which has "onclick" to
open modal dialog:

function openDamnDialog(url)
{
var returnedValue =
window.showModalDialog("/SIMPLE_HTML_PAGE.html","/URL_OF_ASPX_PAGE_THAT_NEEDS_TO_USE_DIALOG.aspx","h elp:no;dialogWidth:500px;dialogHeight:400px;resiza ble:yes;status:no;scroll:no;"));
if(returnedValue)
{
doSomethig();
//Submit the page if you want
formBlah.submit();
}
}
Call this JScript method from your "base" page. Implement some JScript
return value on your aspx list, if you need to. Basically, there is nothing
difficult about this.

Regards,
Kikoz

"Paul K" <Pa***@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
I'm not quite sure if the problem I'm having is a restriction of
showModalDialog or if there is a way around it.

The web app I am working requires the user to select a record from a list.
I pop this list (generated by a second page) in a second window. When the
user selects a record on the datagrid, I close the second window and
submit
the calling page.

If I try to use showModalDialog, the dialog pops up just fine and
everything
is rendered correctly. However, as soon as the page posts back a new
browser
window is opened with what appears to be the response for the post back.

Is there a way around this behavior?

Nov 18 '05 #2
Put

<base target="_self">

in the <head> section

Eliyahu

"Paul K" <Pa***@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
I'm not quite sure if the problem I'm having is a restriction of
showModalDialog or if there is a way around it.

The web app I am working requires the user to select a record from a list.
I pop this list (generated by a second page) in a second window. When the
user selects a record on the datagrid, I close the second window and submit the calling page.

If I try to use showModalDialog, the dialog pops up just fine and everything is rendered correctly. However, as soon as the page posts back a new browser window is opened with what appears to be the response for the post back.

Is there a way around this behavior?

Nov 18 '05 #3
Toda raba!
Nov 18 '05 #4

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

Similar topics

1
by: Gilles T. | last post by:
Hi! I have a popup window open with the showModalDialog function: window.showModalDialog('dialog.aspx',window,"status:no; resizable:yes; dialogWidth:900px; dialogHeight: 700px;"); and in...
2
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for...
6
by: Scott Lee | last post by:
I am displaying an ASP.Net generated form in a popup opened with window.showModalDialog. The form contains DropDownList controls. The first ddl is populated via databinding to a datatable, has...
1
by: John | last post by:
Hi, I'm having a problem opening / downloading csv files when called from a page opened with window.showModalDialog( ). To isolate this problem, I've written 3 files (see below). 1. main.htm...
2
by: John | last post by:
Hi, I posted this earlier in microsoft.public.dotnet.framework.aspnet, but didn't get a response, so I thought I'd try here. Basically, I'm having a problem opening / downloading csv files...
9
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" +...
1
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...
4
by: =?Utf-8?B?Sm9hbyBSZWdv?= | last post by:
Hello, Using asp.net 2.0, C# and IE7 I'm using window.showModalDialog to open a modal window on the client from Javascript. I have to include this line in the < HEAD html of the modal window:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.