Parent widows refresh

P

Peter

1) I have a C# web application and what I am trying to do is create a popup window from a link on the parent window
2) the popup window will have a button and when a user clicks on the button the program should update a database, close the window and refresh the parent window.

My question is does anyone have a example of popup window wich will close it's self and refresh the parent window when a user clicks on a button?

I know there are countless examples of this with Java script, but I can get any of them working with ASP.NET. The biggest problem I have is with refreshing the parent window.

I have tried the following code in the popup window in the button click event, but I keep getting java script error:
'window.opener.document' is null or not an object.

this code is in the
private void butSave_Click(object sender, System.EventArgs e) {

string jscript = "<script language=\"javascript\">" +
"window.opener.refresh();" +
"</script>";
Literal1.Text = jscript;

}

Thanks

Peter
 
R

Rai Yawar Ijaz

try using
document.window.opener.location='abc.aspx';
this code will open that page again and in other words will refresh it ;
1) I have a C# web application and what I am trying to do is create a popup
window from a link on the parent window
2) the popup window will have a button and when a user clicks on the button
the program should update a database, close the window and refresh the
parent window.

My question is does anyone have a example of popup window wich will close
it's self and refresh the parent window when a user clicks on a button?

I know there are countless examples of this with Java script, but I can get
any of them working with ASP.NET. The biggest problem I have is with
refreshing the parent window.

I have tried the following code in the popup window in the button click
event, but I keep getting java script error:
'window.opener.document' is null or not an object.

this code is in the
private void butSave_Click(object sender, System.EventArgs e) {

string jscript = "<script language=\"javascript\">" +
"window.opener.refresh();" +
"</script>";
Literal1.Text = jscript;

}

Thanks

Peter
 
P

Peter

Thanks for your help!

but I have tried this already and getting the same error
'window.opener.document' is null or not an object.
 
R

Rai Yawar Ijaz

i guess that when u opened the window u havnt passed the information of the
parent page i mean submiting its handle to the popup
 
P

Peter

How do I submitt the handle to the pupup?


Here's a sniplet of my code:
//On the parent page I have the following code in the Parent.aspx file

//
//
//
c.Controls.Add(new LiteralControl("<a href=" + q + "javascript://\" onclick=\"javascript: return modalWin('Popup.aspx?Page=CalEvent.aspx')\">test</A>"));

// the following code is in the Popup.aspx file:

Literal1.Text = "<IFRAME NAME='embeddedFrame'" +
" WIDTH='100%' HEIGHT='100%' SRC='" +
Request.Params["Page"] + Params + "' if(self.parent.frames.length != 0) self.parent.location=document.location;/>";

// This code is in the CalEvent.aspx file:

string strjscript = "<script language=\"javascript\">" +
"window.opener.document.URL='http://www.microsoft.com';window.close();"+
"</script>";
Literal1.Text = strjscript;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top