Web bullet box

Source: Internet
Author: User

Using System; using System. Text; namespace Core {// <summary> /// abstract description of MessageBox. /// </Summary> public class MessageBox {public MessageBox () {}/// <summary> /// the confirmation dialog box is displayed. /// </summary> /// <param name = "page"> current page </param> // /<param name = "msg"> message </param> public static void Show (System. web. UI. page page, string msg) {page. registerStartupScript ("alert", "<script language = 'javascript '> alert ('" + msg + "'); </script> ");} ///// <summary> /// control click the message confirmation prompt box /// </summary> /// <param name = "page"> pointer to the current page, this is generally the </param> /// <param name = "msg"> prompt message </param> public static void Confirm (System. web. UI. webControls. webControl Control, string msg) {Control. attributes. add ("onclick", "return confirm ('" + msg + "');") ;}/// <summary> /// the message prompt dialog box is displayed, and perform page Jump // </summary> /// <param name = "page"> current page pointer, this is generally the </param> /// <param name = "msg"> prompt message </param> /// <param name = "url"> jump target URL </param> public static void ShowAndRedirect (System. web. UI. page page, string msg, string url) {StringBuilder Builder = new StringBuilder (); Builder. append ("<script language = 'javascript 'defer>"); Builder. appendFormat ("alert ('{0}');", msg); Builder. appendFormat ("top. location. href = '{0}' ", url); Builder. append ("</script>"); page. registerStartupScript ("message", Builder. toString () ;}/// <summary> /// the message prompt dialog box is displayed, and perform page Jump // </summary> /// <param name = "page"> current page pointer, this is generally the </param> /// <param name = "msg"> prompt message </param> /// <param name = "url"> jump target URL </param> // <param name = "name"> If an iframe has a plate, write the iframe name here </param> public static void ShowAndRedirect (System. web. UI. page page, string msg, string url, string name) {StringBuilder Builder = new StringBuilder (); Builder. append ("<script language = 'javascript 'defer>"); Builder. appendFormat ("alert ('{0}');", msg); Builder. appendFormat ("parent. {1 }. location. href = '{0}' ", url, name); Builder. append ("</script>"); page. registerStartupScript ("message", Builder. toString ());}}}

  

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.