I have one asp.net page , it consists of some controls along with a close button. If the user clicks on the close button, it will open ModaldialogBox with one text box for entering closing reason. Once the user enters the reason and clicking on the save button, the modal popup shows the alert message and close the modal popup. The existing code for this is shown below.
this.Page.ClientScript.RegisterStartupScript(GetType(), "close", "alert('" + Message + "');var xWin=window.dialogArguments;xWin.location.replace(xWin.location);window.close();", true);
My requirement is that, once the user click on the submit button, I have to navigate to the dashboard page after closing the modal popup window.
I had tried window.location.href after the window.close(), It will open another window and displyed the page. But it should navigate from the existing asp parent page. Please help me for resolving this issue.
Thanks in advance
redirect the parent window with following code
window.opener.parent.location.href = 'dashboardurl';
Related
I have a parent page to display the project details, and user enter part details by uploading a template in a modal pop-up.
To open the modal popup I'm calling this function
function importfile()
{
var url="SCN_UploadPart.aspx";
var selSCE=window.showModalDialog(url,'win','help:no;status:no;scroll:no;resize:no;dialogHeight:300px;dialogWidth:490px');
return false;
}
Earlier I was using OnClinetClick method of Uplaod Button to call this method, then the project page or parent page was automatically reloading. But now I'm calling it like this.
ClientScript.RegisterStartupScript(this.GetType(), "project", "<script language='javascript'>importfile();</script>");
onclick of same Upload Button.
I font why the page does not reload now. I want the page to be reloaded as I am showing the content in the parent page after uploading the parts.
Please suggest me the way to reload the Parent page on click of close in modalpopup.
U can refer below link its show the demo
http://codedisplay.com/automaticaly-refresh-parent-window-whenever-popup-window-is-closed/
http://www.mindfiresolutions.com/Refresh-parent-page-on-closing-modal-child-windowpopup-29.php
Hope it helps u
i call bootstraps modal from code-behind,my code:
Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "initMyModal('" + timeRemain + "');", true);
in aspx page:
function initMyModal(timeRemain) {
$(".modal-body").html(timeRemain);
$('#myModal').one().modal('show');
}
My problem is when a user clicks on button back in browser and then click forward the modal appears again.
How can I prevent the display of the modal when users click on the forward button in the browser?
i solved this with using cookie
before modal is display add cookie with value when modal is showing set value in cookie
I'm accessing an SSO through an ASP/C# page and using the following code to open up a popup window:
string s = "window.open('" + getSSOlink(ah1.InstitutionUserID, cardnumber) + "','popup_window', 'width=980,height=600,resizable=yes');";
Page.ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
After opening the popup, I need to click 2 links deep into the the popup window navigate to a specific part of the page. The id on the first page is id25, and on the second page is cuRewardsLink, and it is the same every time the SSO opens. After the 2nd link is clicked, the user will be directed to a Rewards system.
I'm trying to find a way to open a new browser window that navigates automatically to the Rewards page. Ideally, they would not see the loading of the first two pages in the popup, just the final destination. The links within the popup do not have static URLs, there is an AJAX function returning information from the click(s) that create the link.
After the popup opens, I'm not sure how to access the HTML elements in the current browser window (the popup window). I tried using the WebBrowser class to navigate to the page, wait for loading,and click the links, but got a "ThreadState Exception - ActiveX Control cannot be instantiated because the current thread is not in a single thread apartment":
WebBrowser browser = new WebBrowser();
browser.Navigate(getSSOlink(ah1.InstitutionUserID, cardnumber));
Thread.Sleep(1000);
browser.Document.GetElementById("id25").InvokeMember("Click");
Thread.Sleep(1000);
browser.Document.GetElementById("cuRewardsLink").InvokeMember("Click");
browser.Visible = true;
Any help or thoughts would be appreciated,
i have two asp page,first one is home and second one is test. In home page user can select the type of test they want to take up, and after pressing start button a new window is open for taking the test. What i want to achieve is , after completing the test i want to close the test window and redirect to another page, and this redirect should hit the previously opened home window.
You don't clarify that you have popup window or blank window i am aspecting for the popup
In submit click button press
String x = "<script type='text/javascript'>window.opener.location.href='**Your new url of new page after completing test**';self.close();</script>";
ScriptManager.RegisterClientScriptBlock(this.Page,this.Page.GetType(), "script", x,false);
From self close you will be able to close current window and by window.opener.location.href you will able to redirect to new url
I hope this will help you
regards....:)
Yes you can do these 2 ways:
Window.Open() /.showmodalDialog() and keep parent and child open as well, or
On the home page click on your start button. Use code Response.Redirect("~/Test.aspx"); assuming it resides with Home.aspx. Take your test using ASp.Net wizard control or hiddens divs what ever suits you easy. Manipulate data on test page , save and get result to and from database using SqlConnection and SqlCommand assuming you have Sql Server as backend. Hold the table or any value in either cache or Session and throw it on your home page. Do whatever you want.
This will be not possible. What you can do is to redirect the user to the home page after completing the test, but this will be in the same windows.
I'm using the openidbutton to allow users to log into my site with google, yahoo, etc.
When they click the button it redirects to the yahoo page, then redirects back to my page once authenticated.
All that is working great, but the problem is there is no going back once the button is clicked.
So, if they click the yahoo button and it redirects to yahoo's authentication, the back button is now disabled, and they can't change their mind and return to my site without closing the browser.
Here is my code
<rp:OpenIdButton runat="server" ImageUrl="~/images/yahoo.png" Text="Login with Yahoo!" ID="yahooLoginButton"
Identifier="https://me.yahoo.com/" ReturnToUrl="~/OpenIDComplete.aspx" OnLoggingIn="OpenIdLogin1_LoggingIn" OnLoggedIn="OpenIdLogin1_LoggedIn">
<Extensions>
<sreg:ClaimsRequest Email="Require" FullName="Request" />
</Extensions>
</rp:OpenIdButton>
What I've seen and want to reproduce, is when the click the button, it opens a new window that's only used for authentication, then it closes and redirects the parent to the logged in section.
I can't seem to find anyway to do this. Any suggestions?
Thanks
I'm using jQuery Fancybox version 2 (http://fancyapps.com/fancybox/) for my login popup, it works very nicely. I've not actually gone to yahoo and back though but other redirects to pages just go to the popup until I close it.
Then you can reload the main page when you close the popup with
$(".fancybox").fancybox({
afterClose : function() {
location.reload();
return;
}
});