如何在Java Script中显示确认消息 [英] how to Show Confirmation message in Java Script

查看:102
本文介绍了如何在Java Script中显示确认消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在这里展示Javascript Mesage。这个PassCode已经存在!你想要更新这个吗。



  if (passcode == ddlpasscode.SelectedValue&& memberid == Convert.ToInt32(ddlname.SelectedValue))
{
// 这里我想要JavaScript消息确认。然后用户点击Ok UpadteIssuePass函数被调用。除非取消UpadteIssuePass未被调用

// 当用户点击ok时,调用此函数。没有。
p.UpadteIssuePass(ddlpasscode.SelectedValue,Convert.ToInt32(ddlname.SelectedValue),Convert.ToInt32(txtcounting.Text),crtby,con,tran);

}

解决方案

试试这个。



  if (ScriptManager.RegisterStartupScript( this  this  .GetType(),  script  javascript:if(确认('这个PassCode已经存在!你想要更新这个吗。')== false)return false; true ))
{
p.UpadteIssuePass(ddlpasscode.SelectedValue,Convert.ToInt32(ddlname) .SelectedValue),Convert.ToInt32(txtcounting.Text),
crtby,con,tran);

}


你可以使用jquery这样做,这也是最好的方法。

这么多的方法:-1是





< asp:button name =btnid =btnonclic =codebehind Mehtodocclientckick =return ValidationFunctionxmlns:asp =#unknown>









函数ValidationFunction()

{



检查条件是否因为你明显地进入CodeBehing < br $>
和比



f(确认(''这个PassCode已经存在!你想要更新这个吗。')) />
{



返回true

}

其他

{

返回False;

}





//解释: -



//当有人点击你的按钮而不是Client Clik fire和Show Confirm Popup如果//用户点击这个而不是你的表格帖子进入函数是你的代码...









}









如果你的问题没有解决,请给你评论

Here I want to Show Javascript Mesage ."This PassCode Already Exists!Are you Shore you want to update this.

 if (passcode == ddlpasscode.SelectedValue && memberid == Convert.ToInt32(ddlname.SelectedValue))
                      {
                          //Here i want JavaScript Message Confirmation.Then User Click on Ok UpadteIssuePass Function is called.Unless he Cancel UpadteIssuePass is not Called

//this function is called when user click on ok.Unless No.
                        p.UpadteIssuePass(ddlpasscode.SelectedValue, Convert.ToInt32(ddlname.SelectedValue), Convert.ToInt32(txtcounting.Text), crtby, con, tran);

                      }

解决方案

try this.

if(ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "javascript:if(confirm('This PassCode Already Exists!Are you Shore you want to update this.') == false) return false;", true))
{
      p.UpadteIssuePass(ddlpasscode.SelectedValue,     Convert.ToInt32(ddlname.SelectedValue), Convert.ToInt32(txtcounting.Text), 
crtby, con, tran);
                           
}


You can Do this using jquery also it is the best method for this.
so many method to do this :-1 is


<asp:button name="btn" id="btn" onclic="codebehind Mehtod" occlientckick="return ValidationFunction" xmlns:asp="#unknown">




function ValidationFunction()
{

Check Condition if As You PReviously DiD into CodeBehing
and Than

f(confirm(''This PassCode Already Exists!Are you Shore you want to update this.''))
{

return true
}
else
{
return False;
}


//explaination :-

//when Some one click your button than Client Clik fire and Show Confirm Popup if //user click this than your form post into the function which is your code behind ...




}




if your problem is not solve this please give your comment


这篇关于如何在Java Script中显示确认消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆