Click here to Skip to main content
13,095,658 members (52,257 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How to Prevent refreshing parent page when 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>'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 2:10am
Updated 18-Apr-13 2:13am
ryanb31 18-Apr-13 8:14am
window.location.href='opdrepo.aspx' Isn't that changing the url and therefore refreshing the page?
veenusehgal 19-Apr-13 0:44am
Thanks ryanb31 it is a problem Thanks alot. Now its solved
veenusehgal 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
Please Sign up or sign in to vote.

Solution 1

hi veenu,

Try having the javascript function return false to stop the postback
veenusehgal 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2017
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