Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 3:10am
Edited 18-Apr-13 3:13am
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
Please Sign up or sign in to vote.

Solution 1

hi veenu,
Try having the javascript function return false to stop the postback
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 485
1 Maciej Los 285
2 OriginalGriff 285
3 Peter Leow 260
4 John C Rayan 162
0 Sergey Alexandrovich Kryukov 7,203
1 OriginalGriff 5,587
2 Peter Leow 4,097
3 Mika Wendelius 2,850
4 CHill60 2,818

Advertise | Privacy | Mobile
Web01 | 2.8.150224.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2015
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