Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How close Html window when click asp.net button?

Tags:

c#

asp.net

vb.net

I have asp.net button "OK" in html popup window. I after my logic done how close that popup window it self?

<asp:Button Id="btnOK" runat="server"  AccessKey="<%$Resources:
wss,multipages_okbutton_accesskey%>" Width="70px" Text="<%$Resources:wss,
multipages_okbutton_text%>" OnClick="btnOK_Click" />
like image 383
James123 Avatar asked Oct 14 '10 18:10

James123


2 Answers

<asp:Button ID="btnOK" runat="server" OnClientClick="window.close(); return false;" Text="Close" />
like image 199
KBoek Avatar answered Oct 11 '22 22:10

KBoek


All correct but there is another way if you want close the window in your code:

Suppose that the button ID is "ContineButton" and the click event handler name is "ContineButton_Click"

protected void ContineButton_Click(object sender, EventArgs e)
{
    this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);
}
like image 41
Amir Karimi Avatar answered Oct 12 '22 00:10

Amir Karimi