111,126
社区成员
发帖
与我相关
我的任务
分享
DialogResult MsgBoxResult
if (MsgBoxResult == DialogResult.Yes)
{
MessageBox.Show("yes!");
}
if (MsgBoxResult == DialogResult.No)
{
MessageBox.Show("no!");
}
<asp:Button id="b1" onclientclick="return onclient();" onclick="..." runat="server/>
js:
function onclient()
{
if (str=="a")
{
return confirm('确认此操作?');
}
else
return false;
}
if(DialogResult.Yes==MessageBox.Show("退出吗?","提问",
MessageBoxButtons.YesNO,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1
))
{
Application.Exit();
}
if(!IsPostBack)
{
btnDelete.Attributes.Add("onclick",@"return confirm('确认删除用户?')");
}
if( MessageBox.Show("您确定删除吗?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Hand) == DialogResult.Yes)
if(str=="a")
{
if (MsgBoxResult == DialogResult.Yes)
{
你要执行的代码
}
}
if(str=="a")
{
ClientScript.RegisterStartupScript(this.GetType(),"start","<script language='javascript'>confirm('是否***!');</script>");
}