ASP.NET 歪博2.0
得意时淡然,失意时泰然。

第一种,使用JavaScript实现:在aspx文件中拖入一个button按钮,双击按钮,编辑该按钮的事件如下:

1protected void msgButton_Click(object sender, EventArgs e)
2    {
3        Page.RegisterStartupScript("alert""<script language='Javascript'> alert('弹出一个消息框!')</script>");
4    }
 

第二种:利用C#直接实现:

右击Solution Explore中的站点,点击“添加引用”将System.Windows.Forms添加进来

然后在aspx文件中拖入一个button,双击进入对应的.cs文件的编辑,在头部加入如下的引用:

using System.Windows.Forms;

然后编辑对应的ButtonClick事件

protected void Button1_Click(object sender, EventArgs e)
    {
        MessageBox.Show("弹出MessageBox对话框");
    }


 

posted on 2007-05-23 10:54  Jerry.liu  阅读(922)  评论(2编辑  收藏  举报