.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Close a Popup Window page from Code Behind

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net

Good Morning,

I am using the ClientScriptManager class to call a java alert from Code Behind when a condition is not met. This is being done from a page that is already a JavaScript pop up. When the alert is responded to, I want the script to close both the alert AND the page that generated the alert. Everything works as designed until I close the alert window...THEN the user is also forced to close a second page (the original generating page for the alert) to return to the starting point. This seems cumbersome and unprofessional. I Googled a bunch of stuff but cannot seem to come up with just the right one. What I have currently is below. I appreciate any assistance...Thank You, Pat

        if (RadioButtonSelect.Checked == false)
string msg = "My String";
ClientScriptManager script = Page.ClientScript;
if (!script.IsClientScriptBlockRegistered(this.GetType(), "Alert"))
script.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('" + msg + "')", true);

View Complete Post

More Related Resource Links

Refresh parent window and close popup window.


Hi All,

I've been spent the last couple hours trying to work on this issue. I an creating Facebook Oauth stuff, when i click on parent window. The popup shows the Facebook login, when i logged in with my details, it redirects to my site. But i need to close this popup after returning and refrsh the parent window.

can you please provide me this kind of stuff. i already spent whole day in this... Sealed Cry

If i could solve this then i will go for another logic but stucked on 1st step.



close pop up and refresh main page after popup close

I am working on a application in which When user clicks on a button  he should be redirected to facebook login page and after successfull login he shud be reirected back to my page. It all is working fine but now I have to do like thiswhen user click on the Button the the facebookbacklogin page shud be opened in popUp and when login is done successfully the popup window shud be closed and the main page shud be refreshed. anf If user is already login the popup window shud not be opened.How can i do this..How can I KNow that a popup window is opened and how can I close that??How to refresh when popup window is closed.I ahve to do like on this site..http://blippy.com/

refreshing (reloading) the self page when it opens the popup window

silbut = e.Item.FindControl("button4")         silbut.Attributes.Add("onclick", "window.open('firmaus.aspx?i=" + rrid.Text + "&s=" + Session("firma").ToString + "')") Hi all,I add an attribute on data bound event to the datalist with following codein studentlist.aspx page :deletebutton = e.Item.FindControl("button4")deletebutton.Attributes.Add("onclick", "window.open('studentus.aspx?i=" + rrid.Text + "&s=" + Session("studid").ToString + "')")but i want deletebutton to refresh parent page (studentlist.aspx) when i click it, with openning the page (studentus.aspx...)how can i add this attribute?thanks for helps.

Open popup window with js and .net code

I did a little research and all i can find is binding the js to a control that will fire the popup.Is there a way that i can use in code so i can trigger a popup window from vb.net code?Thanks.P.S. If it is to complicated then is there a way to have a button set with the popup message i want the user to view and make the button click with .net code so the onclick event will fire and show the popup window?

close aspx page after executing code behind


I am working in vs 2008, C#.

Load event in my aspx page is having a set of database operations .So after completing those operations i want to close the aspx page.

for that i am calling 

window.close() methond onload event of the body. Its closing the aspx page but it is showing the confirmation message before closing the page.

I dont want to show that message box.

How can i claose an aspx page without showing any message?.

Pls help me



How to close individually the multiple open browser window using c# code?


Hello guys,

The scenario is I have multiple open browser window (IE or Firefox) then I want to close the specific browser individually.

I have tried to lookup the applications running from the task manager but I can't get the running application from the task manager > application > task.

I have added two references below to lookup the task running applications.

using System.Diagnostics;
using System.Threading;

Anyone can help me on how to close individually the specific open browser window using c# code event.


How to freeze the background page when modal popup window called



when i call modal popup extender the background is scrolling , i want to freeze the background page then
 is there any properties or any other idea to get this .. 

Refreshing thumbnail image on parent page on body unload of popup window


Hi, I am facing a problem in refreshing the thumnail image on parent page after body unload method of popup is called.

Below is th JS function I am calling on body unload of popup. Please note that parent window is refreshing but image thumbnail still shows old image. After I refresh the page for second time I see the new thumbnail.

Thannks & Regards

  function refreshParent() {





Modal popup window in ASP.Net

A Masked div or modal popup window is a child window created from the parent window which prevents the user from interacting with parent window before he returns to the parent application.

WebDev.WebServer.exe has encounted a problem and needs to close when trying to view page in browser


Hi, whenever I load an aspx page in vwde2008, I get the message in the subject of this post.  After I click Ok on that, I get a dialog box, Unable to Connect to the ASP.Net development center.  What can I do to troubleshoot?

I am using Windows XP SP3, vwde2008 with SP1, on a HP desktop.  Also using Office 2003 if that is relevant at all.

Thanks, Justin

Open PopUp Window From Error httpModule


I would like to open a popup window from the assembly to present the information to the user. Does anyone know if this is possible, I am presently doing the following:

        WriteLine("body {font-family:""Verdana"";font-weight:normal;font-size: .7em;color:black; background-color:white;}")
        WriteLine("b {font-family:""Verdana"";font-weight:bold;color:black;margin-top: -5px}")
        WriteLine("H1 { font-family:""Verdana"";font-weight:normal;font-size:18pt;color:red }")
        WriteLine("H2 { font-family:""Verdana"";font-weight:normal;font-size:14pt;color:maroon }")
        WriteLine("pre {font-family:""Lucida Console"";font-size: .9em}")

Wicked Code: Silverlight Page Turning Made Simple


As we'll show, with just a few lines of JavaScript you can build a general-purpose framework for incorporating page turns into Silverlight 1.0 apps.

Jeff Prosise

MSDN Magazine May 2008

Open different page using Ajax Modal PopUp Extender Control

The article Open different page using Ajax Modal PopUp Extender Control was added by Chintan Dave on Thursday, July 15, 2010.

You May use Modal Popup Extender to open some part of the page as Popup. But there we don't have any property to open other html or aspx page in Popup window.We can do it using IFrame control. What we have to do, just add IFrame control in Panel that

Problem when displaying a popup window

Hi all,
I am working on a project in which when I clicked a hyperlink a pop up window has to be displayed for 2 pages.
But at first when i did this in javascript it worked, later after i finished the whole coding suddenly an error box displayed that there is an error in webpage and want to debug

Browser window is opening up on the second click with javascript code



I am trying to set a javascript code to open up a new browser window with this URL that exists like shown below.

On the first click nothing happens but on the second click the browser window is opening up.


How is it possible to make it open up on the first click ?

                                <asp:ImageButton ID="ImageButton3" runat="server" Height="84px" 
                                    ImageUrl="~/images/1.jpg" Width="165px" 
                                    onclick="ImageButton3_Click" />

    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
        String openURL = "javascript:window.open('" + "Folder1/testing.aspx" + "');return false;";
        ImageButton3.OnClientClick = openURL;


How to Use Window.close() in C#


Hello Alll

Please Tell me  How to Use Window.close() in C#.. In this case i have to handle both serverside event and client side..


Partial Views and Popups...After clicking on Close need to refresh the page....


Hi All,


I amusing the PopUp example as suggestedin the above forum link.....

But now i want to Refresh the page after clicking on Close(x) ...

So please help me....

Please advice...

Thanks in advance...



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend