Implementation of MessageBox in Asp.net

Source: Internet
Author: User
MessageBox is not used in Asp.net .. If response. write ("#######"), it will be displayed directly on the page ######, which looks messy and not beautiful, it is not easy to see. It is better to use a dialog box. Method: write directlyCode: Response. Write ("<SCRIPT> window. Alert ('#######'); </SCRIPT>. Response. write ("<SCRIPT> alert ('#######'); </SCRIPT>"); after the prompt is successful, go to the response page. write ("<SCRIPT> window. alert ('prompt statement'); window. location = 'abc. aspx '</SCRIPT> "); In Asp.net, you may want to pop up some information boxes when performing an operation: the warning message box popped up by alert, the confirm pop-up dialog box contains the confirmation and cancellation buttons, and the input data dialog box popped up by prompt. There are two methods to achieve this. (1) Alert usage: Response. Write ("<SCRIPT> alert ('incorrect password! ') </SCRIPT> "); (2) Use of confirm: Response. Write (" <SCRIPT> window. Confirm (' Are you sure you want to delete it? '); </SCRIPT> "); (3) Use of prompt: response. write ("<SCRIPT> var result = Window. prompt ('Enter the new file name: '), 'abc'); If (result! = NULL) Alert ('your input is '+ result); </SCRIPT> ");"

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.