ASP.net page Pop-up dialog box

Source: Internet
Author: User

------New MessageBox.cs class------
Using System;
Using System.Text;

Namespace Project.library
{
<summary>
MESSAGEBOX Displays the message prompt dialog box.
</summary>
public class MessageBox
{
Public MessageBox ()
{
//
TODO: Add constructor logic here
//
}
<summary>
Display Message prompt dialog box
</summary>
<param name= "page" > current page pointer, generally this</param>
<param name= "MSG" > Hint info </param>
public static void Show (System.Web.UI.Page Page, String msg)
{
Page. RegisterStartupScript ("message", "<script language= ' JavaScript ' Defer>alert" + MSG. ToString () + "');</script>");
}

<summary>
Control Click the Message confirmation Prompt box
</summary>
<param name= "page" > current page pointer, generally this</param>
<param name= "MSG" > Hint info </param>
public static void Showconfirm (System.Web.UI.WebControls.WebControl control, String msg)
{
CONTROL.ATTRIBUTES.ADD ("OnClick", "If" (!window.confirm (' "+msg+")) {return false;} ");
CONTROL.ATTRIBUTES.ADD ("onclick", "return confirm (' + msg + ');");
}

<summary>
Display the message prompt dialog box and make a page jump
</summary>
<param name= "page" > current page pointer, generally this</param>
<param name= "MSG" > Hint info </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>
        Output custom script information
       ///</summary>
        ///<param name= "page" > current page pointer, generally this</param>
        ///<param name= "script" > Output script </param>
        public static void Responsescript (System.Web.UI.Page Page, String script)
         {
            page. RegisterStartupScript ("message", "<script language= ' JavaScript ' defer>" + script + "</script>");
       }
   }
}
------The CS page calls------
Project.Library.MessageBox.Show (System.Web.UI.Page, "I am the dialog box.) ");

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.