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

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

How to Use Window.close() in C#

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

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..


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.



Modal Window won't close

I have a linkbutton at the end of each record of a gridview that has a client side javascript invoked on the OnClientClick event. It displays a popup modal window. This is applied to each record in the gridview databound event. lnkbtnAppts.OnClientClick = String.Format("javascript:window.showModalDialog('CAPAC_Appointments_Modal.aspx?Client_Name={0}&Client_SR={1}','','dialogWidth:800px; dialogHeight:600px; center:yes');", Client_Name, Row_SR) On the modal window, I have a standard server side button, with attributes applied to run a client side javascript to close the popup window. Seems fair enough! btnClose.Attributes.Add("onclick", "javascript:window.top.close()") The problem is it closes the window, but the popup immediately appears again. The second time I can close the popup window? Not good! Thanks    

Close a Popup Window page from Code Behind


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);

want to disbale Java script message before close window




Hi I have Java script ,

when i close my .aspx page getting yes/no message, i want do disable this message , dont want any message befroe close my window


how i can do


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.


Session expire on window close



I need your help badly. I want to expire session when wndow is directly closed. I have master page.


window.close() not works in firefox


good day to all,

Below mentioned methods does not work in Firefox.

function CloseWindow() {
      if (confirm('Would you like to close the window?')) {

          window.opener = null;

Please provide me solution.

Thanks to all of you.

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.

lossing focus from model pop up window controls


hi i using a model pop up window with some textbox but when i click on textbox of model pop up focus move to back to page textbox control plz help me 

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}")

Create a user friendly pop up window


Hello friends I am new to asp.net programming. While working with windows form(windows application) i have created a window for editing purpose(just like popup window ) which contains three bounded dropdown list a button and a gridview. After making selections from the drop down when we press button the corresponding result should display in a grid.After that when you click on the grid row it will load the corresponding datas in my form. i want to create such control in asp.net . i have to use jquery or ajax.And this pop up window i have to use more than twenty times in my application.am using VS2008 ASP.NET and C# 3.5 . Plese suggest me what to do. Thanks in advance

problem in consuming WCF service through Window application


I have a silverlight application and WCF service all made in VS 2010 , i had hosted my site to web server which contain Window 2008 and IIS 7.0

now the problem is i have another application which is a window application developed in VS2008 , when i try to add the service reference it gives me error


The document at the url was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'DISCO Document' is 'There was an error downloading 'http://dev_qa.emspa.com/HRDev3/Service.svc?disco'.'.

  - The request failed with HTTP status 400: Bad Request.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from '' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: ''.

Content Type application/soap+xml; charset

Crystal Report parameter value window.


 Hi friends,

   I am using Crystal report which displays the result of stroed procedure which have 2 paramater.

  When i run report it shows two window for getting each parameter.

  My need is, can i have one window for getting all the paramter value for stored procedure.


  With Advanced thanks,






Aero Glass: Create Special Effects With The Desktop Window Manager


In this article we introduce the Desktop Window Manager, the new interface that manages how windows are rendered on the Windows Vista desktop.

Ron Fosner

MSDN Magazine April 2007

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