473,651 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modal Dialog

I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to see
if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom
Nov 19 '05 #1
8 2904
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OQ******** ********@TK2MSF TNGP14.phx.gbl. ..
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to
see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom

Nov 19 '05 #2
TJS
not quite modal because you can close the dialog without making a choice
"Robbe Morris [C# MVP]" <in**@turnkeyto ols.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OQ******** ********@TK2MSF TNGP14.phx.gbl. ..
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to
see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom


Nov 19 '05 #3
"Robbe Morris [C# MVP]" <in**@turnkeyto ols.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp
That looks like exactly what I was looking for. I haven't tried it in my
..net pages yet, but I don't see why it wouldn't work. BTW, is there a way
to make the links actual buttons? If not, that's fine.

Thanks,

Tom
--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OQ******** ********@TK2MSF TNGP14.phx.gbl. ..
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section of
the modal window to make it work. I tried putting it both pages just to
see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom


Nov 19 '05 #4
"TJS" <no****@here.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
not quite modal because you can close the dialog without making a choice
I am definately not going to quibble, here. This is exactly what I need.

Is there a way to tell if the window was closed using the "x" or is there a
way to turn the "x" off?

Also, is the line:

ModalDialogInte rval = window.setInter val("ModalDialo gMaintainFocus( )",5);

the one that makes it modal. I assume this is just resetting focus every 5
ms. Is there some reason for using 5 verses 10, 20 or 30 etc?

Thanks,

Tom

"Robbe Morris [C# MVP]" <in**@turnkeyto ols.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OQ******** ********@TK2MSF TNGP14.phx.gbl. ..
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section
of the modal window to make it work. I tried putting it both pages just
to see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom



Nov 19 '05 #5
I wanted to pass in the asp.net object where I want the result to go and
wanted to do something like:

function YesNoCancelRetu rnMethod(return Var)
{
document.getEle mentById(return Var).value = ModalDialog.val ue;
ModalDialogRemo veWatch();
}

but I can't figure out how the javascript call would go:

<a href="javascrip t:YesNoCancel(' Yes, no, or cancel
me','YesNoCance lReturnMethod(m odalreturn1)'); ">Show Modal #1</a>

This doesn't work (which I didn't expect it would). But I can't figure out
how to get the variable name to the event.

Tom

"tshad" <ts**********@f tsolutions.com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
"TJS" <no****@here.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
not quite modal because you can close the dialog without making a choice


I am definately not going to quibble, here. This is exactly what I need.

Is there a way to tell if the window was closed using the "x" or is there
a way to turn the "x" off?

Also, is the line:

ModalDialogInte rval =
window.setInter val("ModalDialo gMaintainFocus( )",5);

the one that makes it modal. I assume this is just resetting focus every
5 ms. Is there some reason for using 5 verses 10, 20 or 30 etc?

Thanks,

Tom


"Robbe Morris [C# MVP]" <in**@turnkeyto ols.com> wrote in message
news:eF******** ******@TK2MSFTN GP12.phx.gbl...
JavaScript Modal Dialog Box - Cross Browser and
highly flexible.

http://www.eggheadcafe.com/articles/...dal_dialog.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx

"tshad" <ts**********@f tsolutions.com> wrote in message
news:OQ******** ********@TK2MSF TNGP14.phx.gbl. ..
I am using Andy Smiths Dialog windows, which work really well.

My only problem is I am trying to make the Dialogs Modal.

Someone mentioned putting <base target="_self"> into the head section
of the modal window to make it work. I tried putting it both pages
just to see if it would work and it doesn't seem to work.

Does anyone know how to make these modal?

Thanks,

Tom



Nov 19 '05 #6
"tshad" <ts**********@f tsolutions.com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
Is there a way to tell if the window was closed using the "x"


If you look at the demo, when you click one of the links it returns "Yes",
"No" etc into the textbox. When you click the x in the top-right corner, it
returns an empty string into the textbox.
Nov 19 '05 #7
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:eV******** ******@TK2MSFTN GP15.phx.gbl...
"tshad" <ts**********@f tsolutions.com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
Is there a way to tell if the window was closed using the "x"
If you look at the demo, when you click one of the links it returns "Yes",
"No" etc into the textbox. When you click the x in the top-right corner,

it returns an empty string into the textbox.


So, I assume the best way to make it work would be to put something in the
textbox and then check if it is empty. If it is, the user pressed the "x"
to close the window.

I am having a problem with using this in an asp.net page using buttons.

I made a change where I pass the title and the name of the textbox to the
function, but otherwise it is the same. Here is the page I am using at the
moment:

*************** *************** *************** *************** *************** *
*
<%@ Page Language="VB" trace="false" debug="true" AutoEventWireup ="true"
ContentType="te xt/html" ResponseEncodin g="iso-8859-1" %>
<!--#include virtual = '/Development/includes/ModalDialogs.in c'-->
<script runat="server">
sub page_load(s as object, e as eventArgs)
if not isPostBack then
Button1.Attribu tes.Add("onclic k", "YesNoCancel('T his is a
test','modalret urn2','Yes, no, or cancel me','YesNoCance lReturnMethod() ');")
end if
end sub
</script>
<form runat="server">
<asp:Button ID="Button1" text="submit" runat="server"/><br>
<input type=text id=modalreturn2 name=modalretur n2 value=''><br>
<a href="javascrip t:YesNoCancel(' This is the first
Title','modalre turn2','Yes, no, or cancel
me','YesNoCance lReturnMethod() ');">Show Modal #1</a>
</form>
<p>&nbsp;</p>
</body>
</html>
*************** *************** *************** *************** **

In this page am calling the javascript popup from a link and a button. With
the link it works everytime I press the link. Once I use the button, it
doesn't work for the link anymore.

For the button, it opens the popup fine, but it never returns when I press
the link on the popup page. It only returns when I press the "x". It never
returns anything from the popup (not even the empty string when pressing the
"x").

At this point, neither the button nor the link will bring up the popup box.

What is the problem here?

Here is the page that is rendered from .aspx:

*************** *************** *************** *************** **************
<script language=JavaSc ript>

var ModalDialogWind ow;
var ModalDialogInte rval;
var ModalDialog = new Object;

ModalDialog.val ue = '';
ModalDialog.eve nthandler = '';
ModalDialog.ret urnAddress = '';
function ModalDialogMain tainFocus()
{
try
{
if (ModalDialogWin dow.closed)
{
window.clearInt erval(ModalDial ogInterval);
eval(ModalDialo g.eventhandler) ;
return;
}
ModalDialogWind ow.focus();
}
catch (everything) { }
}

function ModalDialogRemo veWatch()
{
ModalDialog.val ue = '';
ModalDialog.eve nthandler = '';
}

function ModalDialogShow (Title,ReturnAd dress,BodyText, Buttons,EventHa ndler)
{
alert("this is a test");
ModalDialogRemo veWatch();
ModalDialog.eve nthandler = EventHandler;
ModalDialog.ret urnAddress = ReturnAddress;

var args='width=350 ,height=125,lef t=325,top=300,t oolbar=0,';
args+='location =0,status=0,men ubar=0,scrollba rs=1,resizable= 0';

ModalDialogWind ow=window.open( "","",args) ;
ModalDialogWind ow.document.ope n();
ModalDialogWind ow.document.wri te('<html>');
ModalDialogWind ow.document.wri te('<head>');
ModalDialogWind ow.document.wri te('<style>body {background-color:
#B2CBD2;}</style>')
ModalDialogWind ow.document.wri te('<title>' + Title + '</title>');
ModalDialogWind ow.document.wri te('<script' + ' language=JavaSc ript>');
ModalDialogWind ow.document.wri te('function CloseForm(Respo nse) ');
ModalDialogWind ow.document.wri te('{ ');
ModalDialogWind ow.document.wri te(' window.opener.M odalDialog.valu e =
Response; ');
ModalDialogWind ow.document.wri te(' window.close(); ');
ModalDialogWind ow.document.wri te('} ');
ModalDialogWind ow.document.wri te('</script' + '>');
ModalDialogWind ow.document.wri te('</head>');
ModalDialogWind ow.document.wri te('<body onblur="window. focus();">');
ModalDialogWind ow.document.wri te('<table border=0 width="95%"
align=center cellspacing=0 cellpadding=2>' );
ModalDialogWind ow.document.wri te('<tr><td align=left>' + BodyText +
'</td></tr>');
ModalDialogWind ow.document.wri te('<tr><td align=left><br> </td></tr>');
ModalDialogWind ow.document.wri te('<tr><td align=center>' + Buttons +
'</td></tr>');
ModalDialogWind ow.document.wri te('</body>');
ModalDialogWind ow.document.wri te('</html>');
ModalDialogWind ow.document.clo se();
ModalDialogWind ow.focus();
ModalDialogInte rval = window.setInter val("ModalDialo gMaintainFocus( )",5);

}

</script>

<script language=JavaSc ript>
function YesNoCancel(Tit le,returnAddres s,BodyText,Even tHandler)
{
var Buttons='';
Buttons = '<a href=javascript :CloseForm("Yes ");>Yes</a> ';
Buttons += '<a href=javascript :CloseForm("No" );>No</a> ';
Buttons += '<a href=javascript :CloseForm("Can cel");>Cancel</a> ';
ModalDialogShow (Title,returnAd dress,BodyText, Buttons,EventHa ndler);
}

function YesNoMaybe(Titl e,returnAddress ,BodyText,Event Handler)
{
var Buttons='';
Buttons = '<a
href=javascript :CloseForm("Yes ");>Yes</a>&nbsp;&nbsp;& nbsp;&nbsp; ';
Buttons += '<a
href=javascript :CloseForm("No" );>No</a>&nbsp;&nbsp;& nbsp;&nbsp; ';
Buttons += '<a href=javascript :CloseForm("May be");>Maybe</a> ';
ModalDialogShow (Title,ReturnAd dress,BodyText, Buttons,EventHa ndler);
}

function YesNoCancelRetu rnMethod()
{
document.getEle mentById(ModalD ialog.returnAdd ress).value =
ModalDialog.val ue;
ModalDialogRemo veWatch();
}

function YesNoMaybeRetur nMethod()
{
document.getEle mentById(ModalD ialog.returnAdd ress).value =
ModalDialog.val ue;
ModalDialogRemo veWatch();
}

</script>

<form name="_ctl0" method="post" action="TMP28cy pdoa6c.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTA TE"
value="dDw5NjU1 MTU1O3Q8O2w8aTw xPjs+O2w8dDw7bD xpPDE+Oz47bDx0P HA8O3A8bDxvbmNs a
WNrOz47bDxZZXNO b0NhbmNlbCgnVGh pcyBpcyBhIHRlc3 QnLCdtb2RhbHJld HVybjInLCdZZXMs I
G5vLCBvciBjYW5j ZWwgbWUnLCdZZXN Ob0NhbmNlbFJldH Vybk1ldGhvZCgpJ ylcOzs+Pj47Oz47 P
j47Pj47Pgp4F76k b7VjTMvhPLbWVoJ O6PFw" />

<input type="submit" name="Button1" value="submit" id="Button1"
onclick="YesNoC ancel('This is a test','modalret urn2','Yes, no, or cancel
me','YesNoCance lReturnMethod() ');" /><br>
<input type=text id=modalreturn2 name=modalretur n2 value=''><br>
<a href="javascrip t:YesNoCancel(' This is the first
Title','modalre turn2','Yes, no, or cancel
me','YesNoCance lReturnMethod() ');">Show Modal #1</a>
<input type=hidden name='_sk_scrol lkeepervalue' id='_sk_scrollk eepervalue'
value='0!0'><sc ript>function SKFilter_SetPos ition(){
scrollTo(0,0);} </script><script language='javas cript'>onscroll =
function(){docu ment.getElement ById('_sk_scrol lkeepervalue'). value =
document.body.s crollLeft+'!' + document.body.s crollTop;}</script></form>
<p>&nbsp;</p>

</body>
</html>
*************** *************** *************** *************** **************

Thanks,

Tom
Nov 19 '05 #8
"tshad" <tf*@dslextreme .com> wrote in message
news:u5******** ******@tk2msftn gp13.phx.gbl...
If you look at the demo, when you click one of the links it returns
"Yes",
"No" etc into the textbox. When you click the x in the top-right corner,

it
returns an empty string into the textbox.


So, I assume the best way to make it work would be to put something in the
textbox and then check if it is empty. If it is, the user pressed the "x"
to close the window.


I guess so - or a JavaScript variable...
Nov 19 '05 #9

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

Similar topics

2
6714
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 element in the dropdownlist. Thanks to help me with this problem!
2
3240
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 element in the dropdownlist. Thanks to help me with this problem!
10
2747
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 graphic if the dialog does not present them with one they are already happy with. 4. upon uploading...
0
2686
by: javaguy | last post by:
I'm working with code from the book "Ajax in Action" (by Dave Crane, Manning Press). The chapter 6 code has a "notifier" object. It will show a dialog box with messages in it by attaching a DIV-TABLE-TBODY-TR-TD construct with document.body.appendChild(). It shows a modal dialog box by attaching a full-screen div with document.body.appendChild() and then attaching the DIV-TABLE-TBODY-TR-TD construct to that full-screen div. A snippet...
0
8361
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
8807
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...
1
8466
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
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...
1
6158
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
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
4144
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
2701
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
1588
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.