Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
HI,
How to Prevent refreshing parent page when window.open in server side? Help me
This is My function which i used in 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 18-Apr-13 3:10am
Edited 18-Apr-13 3:13am
RyanDev129.8K
v2
Comments
ryanb31 at 18-Apr-13 8:14am
   
window.location.href='opdrepo.aspx' Isn't that changing the url and therefore refreshing the page?
veenusehgal at 19-Apr-13 0:44am
   
Thanks ryanb31 it is a problem Thanks alot. Now its solved
veenusehgal at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi veenu,
 
Try having the javascript function return false to stop the postback
  Permalink  
Comments
veenusehgal at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 269
1 OriginalGriff 240
2 CPallini 195
3 Maciej Los 177
4 BillWoodruff 173
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100