Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,
How to Prevent refreshing parent page when window.open in server side? Help me
This is My function which i used in c#
C#
private void openWindowScript1()
    {
        DateTime fromdate = Convert.ToDateTime(txtdate.Text);
        DateTime todate = Convert.ToDateTime(txttodate.Text);
        string myScript;
        myScript = "<script>window.open('opdprint.aspx?fromdate=" + fromdate + "&todate=" + todate + "',null,'height=600, width=650,status= no, scrollbars=yes,toolbar=no,location=no,menubar=no,left=95,top=140'); window.location.href='opdrepo.aspx';</script>";
        this.Page.RegisterStartupScript("JavaScript", myScript);
        
        
    }

When I close popup window it refresh parent window. I dont want to refresh parent window
Posted
Updated 18-Apr-13 2:13am
v2
Comments
ZurdoDev 18-Apr-13 8:14am    
window.location.href='opdrepo.aspx' Isn't that changing the url and therefore refreshing the page?
veenusethi 19-Apr-13 0:44am    
Thanks ryanb31 it is a problem Thanks alot. Now its solved
veenusethi 19-Apr-13 0:53am    
But here new Problem is occured when i close popup and then refresh parent page then again it opens the popup window

1 solution

hi veenu,

Try having the javascript function return false to stop the postback
 
Share this answer
 
Comments
veenusethi 19-Apr-13 0:40am    
I tried return false; but it when i use it does not open window on button click

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900