Asp. Several popover hints in net

Source: Internet
Author: User

b/s does not like C/s as a MessageBox can pop up the prompt box, but can be through the "Alert" JS to pop up the message, or through some variant of the JS method.

protected voidMessage_click (Objectsender, EventArgs e) {              //First KindResponse.Write ("<script Language=javascript>alert (' First popup box '); </"+"script>"); //The second KindPage.registerstartupscript ("","<script language= ' javascript ' >window.alert (' Second popup box ');</script>"); //Third KindClientScriptManager ScriptManager =((Page) System.Web.HttpContext.Current.Handler).    ClientScript; Scriptmanager.registerstartupscript (typeof(string),"","alert (' Third popup box ');",true); //Fourth TypePage.ClientScript.RegisterStartupScript (Page.gettype (),"message","<script language= ' javascript ' Defer>alert (' Fourth popup box ');</script>");}

The above four methods are very simple, in fact, the simpler way is to encapsulate them into a method as follows.

//pop-up box Public voidAlert (stringstr_message) {    //First KindResponse.Write ("<script Language=javascript>alert (' First popup box '); </"+"script>"); //The second KindPage.registerstartupscript ("","<script language= ' javascript ' >window.alert (' Second popup box ');</script>"); //Third KindClientScriptManager ScriptManager =((Page) System.Web.HttpContext.Current.Handler).    ClientScript; Scriptmanager.registerstartupscript (typeof(string),"","alert (' Third popup box ');",true); //Fourth TypePage.ClientScript.RegisterStartupScript (Page.gettype (),"message","<script language= ' javascript ' Defer>alert (' Fourth popup box ');</script>");}

When the frequency of use is relatively high, this is very convenient. You just need "Alert" for a moment. Isn't it convenient? If you feel good, try it quickly.

Asp. Several popover hints in net

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.