473,585 Members | 2,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modal dialog in web application

Hi!

I'm working on a web application in Asp.net and what I would like to
have is a cross borwser modal dialog which accepts user's input.

I would like to catch what the user clicked on the dialog. To be more
specific I want to have a confirmation dialog that is shown when a user
clicks on a Delete button (which deletes some values from database). If
Yes is pressed the delete action is processed otherwise modal dialog is
closed.

Modal dialog has to work with IE and Firefox so showModalDialog doesn't
count. Confirm (javascript) also doesn't count because the text on the
buttons must be set programmaticall y (localization).

I have found some pages (line this one:
http://javascript.about.com/library/blmodald1.htm) describing how to
work with modal dialogs, but I have trouble manipulating user's input.

Are there any solutions?

Thanks!

Sep 7 '06 #1
2 3675
Hi,

In a cross browser environment you can't do a modal dialog. The example from
the link is essentially clever tricks with divs (note that in the example
even when the "modal dialog" is shown the keyboard commands are still
working... eg. pressing tab will shift focus through the links on the page,
pressing Enter will activate the link).

So... you're either stuck with modal for IE only, non-model for non-IE. Or
change the interaction design (clicking delete goes to a confirmation page,
clicking confirm on that page does the actual deletion).

For modal IE dialogs if you are doing "things" by postback (forms
submissions) you might run into problems. IE modal dialogs don't like
postbacks... you have to wrap do everything in an iframe and do the post
backs there. A bit messy feeling... but not so bad once you've got it
working.

With non-IE part of the "trick" is having the parent window react once the
user has finished doing something. The "window.par ent" and
"window.parent. opener" is your friend here.

Here's a sample script that will call "DoMyThing" in the parent/opener. This
assumes the use of the outer/inner document via an IFRAME, and it is careful
to be cross browser (if dialogArguments exists it uses that... which is IE
specific). It is also careful to handle wierd situations (the original
window has been closed or the user has navigated away from the original
page):

<SCRIPT TYPE="text/javascript">
if (!window.parent )
window.close();
else
{
var opener;
if (window.parent. dialogArguments )
opener = window.parent.d ialogArguments;
else
opener = window.parent.o pener;
if (opener && !opener.isClose d)
{
if (opener.AddNewU ser)
{
try {
opener.DoMyThin g();
} catch (ex) { }
}
}
window.parent.c lose();
}
</script>

Hope that all makes sense :)

Rob MacFadyen

ps. One last note... when opening windows and hiding tool bars and such...
don't bother trying to hide the status bar. More and more this is being
disallowed for security reasons... so you're better off always showing it
and adjust the visual design to accomedate it.
<st******@gmail .comwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Hi!

I'm working on a web application in Asp.net and what I would like to
have is a cross borwser modal dialog which accepts user's input.

I would like to catch what the user clicked on the dialog. To be more
specific I want to have a confirmation dialog that is shown when a user
clicks on a Delete button (which deletes some values from database). If
Yes is pressed the delete action is processed otherwise modal dialog is
closed.

Modal dialog has to work with IE and Firefox so showModalDialog doesn't
count. Confirm (javascript) also doesn't count because the text on the
buttons must be set programmaticall y (localization).

I have found some pages (line this one:
http://javascript.about.com/library/blmodald1.htm) describing how to
work with modal dialogs, but I have trouble manipulating user's input.

Are there any solutions?

Thanks!

Sep 7 '06 #2
You can also create modal dialog with window.open (which works with
Firefox), I've used that techniwue in my blog post

ASP.NET: causing a postback after modal dialog is closed
http://aspadvice.com/blogs/joteke/ar.../05/20331.aspx

Essentially the relevamnt snippet there is:

if(window.showM odalDialog)
{
var args=new Object();
args.window = window;
args.doPostBack = doPostBack;

window.showModa lDialog('Dialog .aspx', args);
}
else
{
window.open('Di alog.aspx','',' modal=yes');
}

Of course with arguments to window.open and showModalDialog , you have more
control over the size etc of the dialog window.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<st******@gmail .comwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Hi!

I'm working on a web application in Asp.net and what I would like to
have is a cross borwser modal dialog which accepts user's input.

I would like to catch what the user clicked on the dialog. To be more
specific I want to have a confirmation dialog that is shown when a user
clicks on a Delete button (which deletes some values from database). If
Yes is pressed the delete action is processed otherwise modal dialog is
closed.

Modal dialog has to work with IE and Firefox so showModalDialog doesn't
count. Confirm (javascript) also doesn't count because the text on the
buttons must be set programmaticall y (localization).

I have found some pages (line this one:
http://javascript.about.com/library/blmodald1.htm) describing how to
work with modal dialogs, but I have trouble manipulating user's input.

Are there any solutions?

Thanks!

Sep 7 '06 #3

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

Similar topics

2
6710
by: Gilles T. | last post by:
Hi, How I can refresh a modal dialog in asp.net? I open a modal dialog in first with a dropdownlist. To add a element in my dropdownlist (table), I open a second modal dialog to ask element and save. When I return in my first modal dialog, dropdownlist is not refreshed. I don't know how to refresh my first modal dialog to view my new...
0
1831
by: Nonoy of Philippines | last post by:
Hello, guys... I'm just starting to develop web applications and I have this problem regarding Session objects At some parts of my application, I open modal dialog window which also opens another window to display a report. To do this, I use the values of Sessions I initialize at the windows that called the modal dialog box. However, I...
3
6629
by: Rod | last post by:
I have an asp.net application where some of the interaction with the user is through modal dialog windows. This works very well except for the annoying fact that the dialog window always returns to its initial position when the user posts back (by clicking a button, etc.) I have all of the fundamentals for asp.net modal dialogs in place,...
3
5835
by: Cosh | last post by:
Hi I want to ask for a user before running the application, and be able to restart the application if the user wants to change the "user" In my main methode I have something like this (pseudocode) static void main() //My user dialoo MyUserDialog mud = new MyUserDialog(
3
8141
by: Andrew | last post by:
I get a Null Reference Exception if I close a non-modal dialog (that is, a form opened with Show()) when a selection is made from a ComboBox. The error message refers to Unsafe Native Methods, but the code is 100% managed. The exception is not thrown if the dialog was modal (opened with ShowDialog()) or if the selection is made from, say, a...
10
2743
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a preview DIV) 2. when users close the dialog, the application receives the URL to the selected graphic. 3. the modal dialog lets the users upload a new...
1
355
by: Ganesh Ramamurthy | last post by:
Hi Experts, I am having a serious problem now. I am using IE for developing my asp.net application. My application need not run in Netscape. I have a peculiar problem. I have an aspx page from which when the user clicks on the save button, I am calling a javascript function which shows up a modal dialog box. I want the user to do certain...
1
3858
by: dan.c.roth | last post by:
oForm.Close() vs this.Close() in a modal dialog. oFrom.Close() calls Form.Dispose() but this.Close() ,say in the click event of the Form, does not. I can think of the reason for this but is this documented and if so can someone give me the reference. And is this true for .net 1 and 2. Thanks
4
2134
by: Steve | last post by:
Hi guys, You know how annoying it is when Visual Studio keeps asking you for a username and password to access TFS? I figured it would be easy to write a little System Tray utility that could use SendKeys to enter the username and password into the dialog box and click the OK button. (I ultimately plan on making the application generic so...
0
8195
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. ...
1
7947
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8209
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...
0
6596
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...
1
5707
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5386
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...
0
3856
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1171
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...

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.