How to get the parent page name of the modal popup dialog? I have one page that is using in two or more pages by using modal popup. When the close button of the modal popup dialog window, it will redirect to the orgin. But where from we will get the parent page name by programmatically?
You can get a reference to the parent from javascripts window.opener object, if the current window was indeed opened in a popup/modal dialog.
As David says, you can use window.opener to get the page that opened a popup window.
However, if you're using a ModalPopupExtender from the AJAX Control Toolkit then you'll likely already be on that page, in which case you'd need to hook up something to the OnOkScript or OnCancelScript attributes of the extender to refresh the page.
If you could post some code it'll make it easier to offer a solution.
Related
I have to fix one issue in our application that, If child window is opened and user clicks on Browser back button i need to redirect to page asking username and password.
we have 400 aspx pages so just i need to modify in master page. I have code like below
function initPage(){
checkback();
}
This function is written in external javascript file and used in Master Page.
checkback function contains code like below
if (document.forms[0].cprotection.value=='1')
{
document.forms[0].pagecode.value=0;
document.forms[0].act.value='backpressed';
document.forms[0].submit()
}
The above code is working fine for parent window but not if i open child window.
backpressed is keyword am using to check in class file to redirect to page asking username and password. Please help me out in fixing this issue. Thanks in advance
You could add a variable to the session when the child window is loaded and if the user clicks back you would check the session to see if the variable that the child window added to session is nothing inside whichever pages load function and if it is then load normally, if its not redirect to the login page.
I have a Modal Box that opens by clicking a HyperLink.
In the Modal Box I fill out information used to create a new site. When I click the button "Create Project" I want the Modal Box to close and the page to redirect to the new site.
I have tried Response.Redirect(url); but this will open the new site in the Modal Box.
How do I solve this?
Thanks for helping.
The parent page could retrieve the “Call-back” parameters, so we can receive this token and redirect.
Perhabs this solution will help you allong:
http://www.chakkaradeep.com/post/Using-the-SharePoint-2010-Modal-Dialog.aspx
I have a FormView that has two buttons on them. What I need to happen is when the user clicks on the buttons, a popup window is displayed. The data in this window is being pulled from a stored procedure in which I will need to pass variables. Can someone supply code on how to do this?
Create a new page. This is your popup (ie popup). On the your calling page add a hyperlink that calls you popup page but make sure the Target attribute is set to _new which tells the link to open a new browser instance.
Open popup page.
In your pop up page you would then call your ADO.net sql specific code in the Page_Load event.
Are you passing a url encoded variable to this page?
I have a .net 3.5 page which has a form control (form1) and with that form is an iframe which contains a page which contains a form (form_tester). What I am trying to do is submit form1 and at the same time submit form_tester that is within the iframe, how do you do that? I know I can submit the form via javascript but I am just wondering if there is a standard way, or a better way of doing it?
Thanks.
I did it in the end by adding a button to the page (form) the was encapsulated within the iframe. Then I added an onclientclick event to the submit button. I then added some javascipt which clicks the button on the encapsulated page and hence it get's submitted. The hardest part was working out how to access the elements on the encapsulated form.
window.frames["frame1"].document.forms['hidden_form']["submit_btn"].click();
but it does work.
Using C#, ASP.Net
In my webpage i have the link for the another web page, if i click the link that should display a another page inside the main page like child page.
Another webpage should display like a popup window in my webpage. And also size of the another webpage should be small. How to do this.
Need Help.
For displaying one web page within another look at using frames (or an inline frame - iFrame)
The second part of your question I think is asking to be able to display the link in a separate window. To do this, use the target="blank" attribute in the anchor tag. to set the size of the child window you will need to use javascript:
<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=190,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>
So just call the showPopup method from your anchor click event
link text
Ideally you would move the javascript so that it is no longer inline, but this should work.
For the first part you need a master page
For the second part you might need a modal popup or it's jQuery equivalent
However, I don't understand what you mean with
And also size of the another webpage should be small. How to do this.
Another webpage should display like a
popup window in my webpage. And also
size of the another webpage should be
small. How to do this.
Did you mean a jQuery Modal Window?