How to Implement the prompt dialog box in Asp.net ()

Source: Internet
Author: User

C #, the pop-up window code is:

MessageBox ("incorrect user name or password! "," Error :");

In Asp.net, this method cannot be used. In this case, we can write a class Message (the name can be obtained at Will) with the following content:

Using System;

Namespace Common
{
/// <Summary>
/// Message summary.
/// </Summary>
Public class Message
{
Public Message ()
{
//
// TODO: add the constructor logic here
//
}

// Return to a pop-up window
Public static string Show (string strMsg)
{

// Here 0 refers to strMsg, and 1 refers to it.
Return String. format ("<script language = {1} javascript {1}> alert ({1} {0} {1}); </script>", strMsg, """);
}
}
}

Then, add a label control on the page where the dialog box is to be displayed. Assume that the control is named lblMsg. Then, write the code in the background:

LblMsg. Text = Message. Show ("content to be popped out here ");

In this way, the effects of the pop-up prompt can be realized. Note that my class is written in the general layer, so you must first reference the General layer:

Using Common;


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.