---
title: "一个ASP.NET中使用的MessageBox类"
author: "249080378"
date: "2010-03-30T16:07:54Z"
tags: [".net", "ASP", "ASP.net", "UI", "Web"]
categories: ["编程语言"]
slug: "asp-net-messagebox"
draft: false
lastmod: "2010-03-30T16:07:54Z"
id: 628317
url: "https://249080378.iteye.com/blog/628317"
---

```
/// <summary>
 /// 自定义信息对话框
 /// </summary>
 public class MessageBox
 {
  /// <summary>
  /// 定义一个web页面，用来显示用户自定错误提示信息
  /// </summary>
  System.Web.UI.Page p;
  /// <summary>
  /// 实例时，参数为:this 如：MessageBox MB=new MessageBox(this);
  /// </summary>
  /// <param name="Page">此参数为：this</param>
  public  MessageBox(System.Web.UI.Page Page)
  {
   p=Page; //创建页面
  }
  /// <summary>
  /// 显示对话框
  /// </summary>
  /// <param name="message">提示信息</param>
  public void Show(string message)
  {
   string  script="<script> alert('"+ message +"')</script>";
   p.Response.Write(script);
  }
 }   
```