首先要加引用System.Windows.Forms.dll 之后再写命名空间using System.Windows.Forms 那么你就可以使用 MessageBox.Show("You must enter a name.", "Name Entry Error",MessageBoxButtons.YesNo, MessageBoxIcon.Information,MessageBoxDefaultButton.Button1,MessageBoxOptions.ServiceNotification);
可以确定或取消
所以不要alert
要么messagebox
能详细点吗
谢
我想知道怎么能用messagebox
webform中可以用Response.Write("<script language='javascript'>alert('Error');history.back(-1);</script>");
显示在服务器端,要用:
在page_load中加入:
button1.attributes.add("onclick","javascript:return confirm('are you sure?');")button1为你要处理事件的按钮。
之后再写命名空间using System.Windows.Forms
那么你就可以使用
MessageBox.Show("You must enter a name.", "Name Entry Error",MessageBoxButtons.YesNo, MessageBoxIcon.Information,MessageBoxDefaultButton.Button1,MessageBoxOptions.ServiceNotification);
Button2.Attributes["onclick"]="return confirm("是否继续?")";
http://www.aspxcontrol.com