Click here to Skip to main content
15,742,263 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
how to close modal dialog form in asp.net automatically.

I try to close the aspx window using window.close() option

but it is asking a security question do you want to close the window.

if I select yes then the window get closed.

I dont want to ask any question.
Posted

1 solution

Try this:

C#
//in Codebehind file "abc.cs"
private void CloseDialog()
    {
        string script = "window.close();";
        System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), 
         "CloseWindow", script, true);
    }
 
Share this answer
 
Comments
trung05ct 26-Aug-10 3:05am    
I am trying from your code but it open this dialog. It doesn't close

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900