I think this question is frequently asked. In fact, this is not a difficult issue. I have sorted out the index myself for reference by cainiao. You can refer to the message dialog box and confirmation dialog box displayed in ASP.
The simplest pop-up message box method requires only one code:
Response. Write ("javascript: alert ('you're a dumb! ')");
Or:
. Attributes. Add ("onclike", "return confirm ('Are you okay? ')");
Page. RegisterStartupScript ("","");
To bring up the confirmation dialog box, you can change alert in Page. RegisterStartupScript ("", ""); to confirm, as shown in the following figure:
Page. RegisterStartupScript ("","");
The pop-up message box is more complex. You can also reference:
System. Windows. Forms. dll
Using System. Windows. Forms. MessageBox;
Then use MessageBox. Show (); for example:
MessageBox. Show ("You must enter the content! "," Name Entry Error ", MessageBoxButtons. OK, MessageBoxIcon. Exclamation); Button1.Attributes. Add (" onclike "," return confirm ('Are you sure you want to perform this operation? ')");
Well, these are relatively simple methods. I believe they will be very practical for beginners of ASP. NET. Let's try them on your own.