I have an aspx page with an iFrame. The iFrame's src is set to a child aspx page.
I somehow need to display a modal popup form on the parent aspx page, to be shown when clicking a button on the child aspx page.
Something like:
Function ShowIt()
{
document.parent.getElemtentById("<%= modal.clientID %>").show();
// Or
$parent.find('modal').show();
}
Any ideas would be greatly appreciated!
Thanks,
Jason
Set BehaviorID property value for a ModalPopupExtender and use this script : window.parent.$find('behaviorId').show();
Related
I got one classic asp page and another aspx page. The classic asp page will be the parent page and the aspx page will be the child page. The child page will have a code behind page that update or add the data. The changes after any operation (update/add) will be reflected immediately at the parent page, after the child close via window.close().
I have tried to set hidden variable at the parent page and set the hidden variable at the child page and put it at body onunload event, but it seems not working.
My classic asp page:
if Request.Form="" then
if Request.Form("hidMode") = "Cr" and Request.Form("hidECardID") <> "" then
SuccessMsg = "The ECard ID template is successfully created."
end if
end if
At end of classic asp page (before form tag closing):
<input type="hidden" name="hidMode">
<input type="hidden" name="hidECardID">
My aspx page:
inside head tag:
<script type="text/javascript">
function passVal() {
winObj = window.opener
//alert(window.opener.location.href) //doesn't produce popup
eCardID =<%=hdECardID.Value%>
docMode =<%=hdMode1.Value%>
winObj.document.form1.hidECardID.value = eCardID;
winObj.document.form1.hidMode.value = docMode;
window.opener.document.form1.submit();
window.close()
}
</script>
At body tag:
<body onunload="passVal()">
I've search for answer but mostly is aspx to aspx page. I could use response.redirect, but my issue is this aspx is a pop-up (not an iframe), after user clicked on a button on the classic asp page. Using response.redirect will only open the page inside the pop-up itself, and not refreshing the parent page.
I have a contact form inserted into my website via an iframe. I am unable to modify the contact form but I can insert some javascript within the iframe itself. I would like to have the contact form redirect the user to a new page upon successfully submitting the form. That new page should load in the parent page and not the iframe. Any ideas how I could accomplish this? This is the page i'm trying to modify http://www.oneupland.com/contact
After a successful submission try executing either of the below
window.location.href="https://stackoverflow.com"
or
window.location.replace("http://stackoverflow.com");
Not really sure if u can access it but u can try something like this..
// keep a reference to the window element of the iframe :
var winIFrame = window.frames["myFrame"].contentWindow;
// with this you can access any DOM element in the iframe
winIFrame.document.getElementById("myForm").onsubmit = function() {
window.location.replace("http://your_redirect.com");
return false;
}
I have an update panel in aspx page.
Click on one of the button show a div from code behind, and load to that div element from another page
ScriptManager.RegisterClientScriptBlock(this.Page, typeof(UpdatePanel), Guid.NewGuid().ToString(),
"UpsalePopup(); $('#MyDiv').load('PopUp/UpsaleAdv.aspx #UpsaleAdvPanel');"
, true);
And its working perfect.
After user close that div (have only picture)
click on asp Button to do function on server side, go to '/UpsaleAdv.aspx' and show it as 404.
Is the load() function ruin my page ? how can I prevent it or solve it ?
The page 'PopUp/UpsaleAdv.aspx' was an aspx page with <form> tag.
And after do this function:
$('#MyDiv').load('PopUp/UpsaleAdv.aspx #UpsaleAdvPanel');"
it makes the current page (myaspa.aspx) to get the funcunality from PopUp/UpsaleAdv.aspx
And once I removed the <form> tag and replaced the page to inherit from master page all works perfect.
I am doing some twitter authentication in classic asp (I know, but I can't change it). What I am doing is opening an authentication page in a popup via jQuery/JS with window.open that handels all of the rest/oauth authentication and then returns to the same page with the oauth keys I need. I would then like to close the popup and fire off some jQuery hide/show events without refreshing the page.
Code to fireoff the popup and authentication script:
jQuery(document).ready(function() {
jQuery("#twitter-button").live("click", function() {
jQuery("#twitter-button").attr("value", "Processing");
jQuery("#twitter-button").removeClass();
jQuery("#twitter-button").addClass("twitter-button-processing");
window.open('authentication.asp','_blank','width=600,height=400');
return false;
});
});
I then have the following code on the same page nested in some ASP for when we are redirected back:
if Session("OAUTH_TOKEN") <> "" And Session("OAUTH_TOKEN_SECRET") <> "" Then
%>
<script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
window.close();
// I'd like to show/hide new buttons on the parent page here
});
</script>
<%
End If
The goal is to change the button with a class of twitter-button-processing displaying none but I can not get it to change in the parent window. I have tried placing jQuery('.twitter-button-processing').hide(); in a jQuery(window).unload() function after the close but this did not produce the correct result.
I tried the solutions from Binding jQuery event on a child window and How to run function of parent window when child window closes? to no avail. Any help would be fantastic.
So I ended up pinpointing the answer on my own. Instead of redirecting back to the same page which was getting messy, I am redirecting to a blank page from the twitter popup window with some classic ASP that checks a few session variables.
Main File
var someFunction = function(data){
//some functionality
}
Twitter Popup Redirect window in the asp checks
window.opener.someFunction();
window.close();
This did exactly what I needed to do by calling the JS on the parent window while closing the child. Maybe this will help someone else.
Okay, the story is abit long but hope you can bear with me so that there could be some background to the problem:
I'm developing the registration section for a portal using ASP.NET and to make things nice,
I decided to use bPopup from here to load the registration page into the iframe of the calling page (parent page). Now I need a way to close down the iframe after a successful registration so from the codebehind of the registration page (nested in the iframe) I tried a Javascript function from the parent that allows me to do so, here's the function to close the iframe generated by the plugin:
function bPopup_close() {
$(".bClose").closePopup();
return false;
}
and here's the code behind from the iframe (the function will be called on submit):
ClientScript.RegisterOnSubmitStatement
(GetType(), "Javascript", "javascript: window.opener.bPopup_close();");
I wasn't able to close the popup. Interestingly, Firebug showed me that after I clicked the submit button, window.opener was null. Does that mean that the parent was indeed closed? Anyway the popup was still there...
Hope you guys could share some insights on anything similar?
I can see that dinbror already answered you on his page :)
#fred: Glad you like it. Are you using
the newest version of bPopup?
Solution: Create a function on the
page which opens the popup:
function closeBPopup() {
$(selector).bPopup().close() }
Then you can trigger it inside your
iframe whenever you are done doing
your stuff with:
parent.closeBPopup();
After half a day, I finally got it working with:
ClientScript.RegisterStartupScript
(GetType(), "blah", "< script type=\"text/javascript\">bclose(); < /script> ", false);
and the code bclose() is:
function bclose() {
parent.$("#popup").bPopup().close();
return false;
}