Three methods for processing client pop-up messages

zhaozj2021-02-16  99

Sometimes I want to pop up a message in the client to prompt the user, not simply print a prompt message on the page, so that the page is not beautiful. The method of implementing the client pop-up message is simple, mainly binding events to buttons, or it can be implemented like MessageBox as in WIN FORM.

¹¹ With the button's Attribute property, the idea is to bind a Click event of the button with a JavaScript code.

Example: this.button1.attributes ["onclick"] = "JavaScript: Return Confirm ('Hello, Invoke from Load'";

The front part of this code is this.button1.attributes ["onclick] this refers to the click attribute of the button, and the rear section refers to the trigger processing of the Click event, using a JavaScript script.

2 The second method is similar to the first, as follows:

Webform1.aspx.cs: this.button1.attributes.add ("onclick", "javascript: return test ()");

Webform1.aspx: