Functional requirements: In the framework, use the ImageButton control to close the application and call JavaScript in The OnClick event (C #) of ImageButton to close IE.
Problem proposal: When the dialog box is displayed, the content in the subinterface is lost. Even if you do not exit the system, you cannot return to the original status.
Solution: Do not directly use the ImageButton OnClick event (C #), but use the Attributes of ImageButton. add ("OnClick", "javascript :... ") to solve this problem.
1. aspx file:
The Code is as follows:
<! -- Aspx file -->
<Asp: ImageButton ID = "ImageButton_Close" runat = "server" ImageUrl = "~ /Images/Icons/stop.gif "/>
2. C # file:
The Code is as follows:
//. Cs File
// Add events and run JavaScript code
Protected void Page_Load (object sender, EventArgs e)
{
If (! IsPostBack)
{
ImageButton_Close.Attributes.Add ("OnClick", "javascript: if (confirm ('try it, can it be successful? ') Return false ;");
}
}