Asp. NET pop-up message box, confirmation box code collection

Source: Internet
Author: User

Feel this problem is frequently asked, in fact, this is not a difficult problem ah, the index of their own tidy up a bit, convenient rookie reference it. Pop-up message dialog box in ASP, the confirmation dialog box can be referenced.

The simplest way to pop up a message box is to have just one sentence of code:

Response.Write (' You are a big fool! ') ("Javascript:alert");

Or:

. Attributes.Add ("Onclike", "Return confirm" (' Are you OK? '));

Page.registerstartupscript ("", "");

If you want to eject the confirmation dialog box, you can change the Page.registerstartupscript ("", "") to confirm, like this:

Page.registerstartupscript ("", "");

A more complex way to pop up a message box, you can also refer to:

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 (' You confirm this operation? ')");

OK, these are relatively simple methods, I believe it will be very practical for asp.net novice, try it yourself.

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.