Prompts in several pop-up boxes in ASP. NET

Source: Internet
Author: User

B/S is not like C/S. A MessageBox can pop up a prompt box. However, you can use js's "Alert" to pop up messages, or use some variant js methods. I would like to introduce you to the following categories. Four pop-up box codes: [csharp] protected void Message_Click (object sender, EventArgs e) {// The first Response. write ("<script language = javascript> alert ('first pop-up box '); </" + "script>"); // second Page. registerStartupScript ("", "<script language = 'javascript '> window. alert ('second pop-up box '); </script> "); // ClientScriptManager scriptManager = (Page) System. web. httpContext. current. handler ). clientScript; scriptManager. registerStartupScri Pt (typeof (string), "", "alert ('third pop-up box ');", true); // The fourth Page. clientScript. registerStartupScript (Page. getType (), "message", "<script language = 'javascript 'defer> alert ('Fourth pop-up box'); </script> ");} the above four methods are very simple. In fact, the simpler method is to encapsulate them into a method as follows. [Csharp] // the pop-up box public void Alert (string str_Message) {// The first Response. write ("<script language = javascript> alert ('first pop-up box '); </" + "script>"); // The second www.2cto.com Page. registerStartupScript ("", "<script language = 'javascript '> window. alert ('second pop-up box '); </script> "); // ClientScriptManager scriptManager = (Page) System. web. httpContext. current. handler ). clientScript; scriptManager. registerStartupScript (typeof (String), "", "alert ('third pop-up box ');", true); // The fourth Page. clientScript. registerStartupScript (Page. getType (), "message", "<script language = 'javascript 'defer> alert ('Fourth pop-up box'); </script> ");} when the usage frequency is relatively high, it is very convenient. You only need "Alert. Is it convenient? If you think it is good, just give it a try.

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.