473,779 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.showModa lDialog 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 7228
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_PAG E.html:

<html>
<head>
<script language="javas cript">
function InitFrame(){doc ument.all.frCon tainer.src =
window.dialogAr guments;}
</script>
</head>
<body onload="InitFra me();">
<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.showModa lDialog("/SIMPLE_HTML_PAG E.html","/URL_OF_ASPX_PAG E_THAT_NEEDS_TO _USE_DIALOG.asp x","help:no;dia logWidth:500px; dialogHeight:40 0px;resizable:y es;status:no;sc roll:no;"));
if(returnedValu e)
{
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***@discussi ons.microsoft.c om> wrote in message
news:E2******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:E2******** *************** ***********@mic rosoft.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
4157
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 dialog.aspx, I need to print the page with javascript function window.print but this function don't work with the showModalDialog window. Why?
2
16148
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 showModalDialog. It is modal as far as the client is concerned but not the server... In my app I have a datagrid on the main aspx page, I pop up a modal dialog to edit a record. On closing the modal dialog I'd like to refresh the
6
5408
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 its AutoPostBack set to true and has its SelectedIndexChanged event being handled in codebehind. The event fires as it should populating two more ddls. The problem is, the two ddls appear empty. I have used a javascript alert to look at the...
1
3578
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 allows the user to open the page containing the link in a regular window or one opened via window.showModalDialog( ) 2. modal.htm provides a link to the aspx which generates the csv 3. csv.aspx generates a csv file
2
4397
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 when generated from within a page opened with window.showModalDialog( ) ( IE6 ). To isolate this problem, I've written 3 files (see below). 1. main.htm allows the user to open the page containing the link in a
9
4657
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();" + "}" + "</script>";
1
2720
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)
4
4576
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: <base target=_selfbecause whenever that page posted back, it would spawn off a new window!! This is the beaviour in IE7.
0
9474
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
10306
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
9930
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
8961
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
6724
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
5373
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...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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.