PrimeNY
asked on
Calling a Java PopUp window from VB.Net code
Creating a web site using Visual Web Developer 2005 Express (Asp.Net 2.0) using VB.
I have a page that uses Java PopUp windows:
<SCRIPT LANGUAGE="JavaScript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,lo cation=0,s tatusbar=0 ,menubar=0 ,resizable =0,width=5 00,height= 200,left = 390,top = 284');");}
And then calll the popup with:
<a href="javascript:popUp('.. /popup.htm ')">
<span style="font-size: 16pt"><strong>?</strong></ span></a>
Now I would like to call a popup for the same page within VB code:
Protected Sub NewButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If CheckBox3.Checked = False And CheckBox4.Checked = False Then
'call popup
End If
Can I do this?
Thanks in advance for your help.
I have a page that uses Java PopUp windows:
<SCRIPT LANGUAGE="JavaScript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,lo
And then calll the popup with:
<a href="javascript:popUp('..
<span style="font-size: 16pt"><strong>?</strong></
Now I would like to call a popup for the same page within VB code:
Protected Sub NewButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If CheckBox3.Checked = False And CheckBox4.Checked = False Then
'call popup
End If
Can I do this?
Thanks in advance for your help.
ASKER
Thanks, and I'm sure this is a stupid question but....how do I keep the popup window on top. It shows for a second and then hides behind main page.
>>I'm sure this is a stupid question but
Not at all!
With javascript "window.open"....you can't always force it to stay on top....you can try modifying your script so that it does try to keep the popup modal....but you might still get inconsistent results with different browsers....
http://javascript.about.com/library/blmodal.htm
A different route is to use something like:
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx
Not at all!
With javascript "window.open"....you can't always force it to stay on top....you can try modifying your script so that it does try to keep the popup modal....but you might still get inconsistent results with different browsers....
http://javascript.about.com/library/blmodal.htm
A different route is to use something like:
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx
ASKER
The problem is that as soon as a user clicks on the buttom in the main page that opens the popup window, the popup window flashes on top for just a split second and then the popup window is immediately minimized. I understand that it is difficult to keep the popup window on top when users click elsewhere, but that is not my concern. I just need the popup to stay on top when it is initially opened.
I think (as you indicated) that I need "window.open" in the VB code that you provided, but I don't know where. Sorry, but my limited background is only in Flash and VB5.
I think (as you indicated) that I need "window.open" in the VB code that you provided, but I don't know where. Sorry, but my limited background is only in Flash and VB5.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
After hours of investigative work through my code I discovered that the problem was caused by me putting "SmartNavigation="True" in the page directive to return the page when RequiredFieldValidator is triggered.
Thanks very much for your help!
Thanks very much for your help!
If CheckBox3.Checked = False And CheckBox4.Checked = False Then
If Not Page.ClientScript.IsStartu
Page.ClientScript.Register
End If
End If