ASP. NET pop-up message box and confirmation box code collection

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.