Javascript 从onClientClick转换为onClientClick
我目前有一个JavaScript方法,查看页面是否经过验证,如果是,允许用户按下create按钮并抛出radconfirm,我遇到的问题是,如果我使用radButton,它工作得很好,但当使用ASP:按钮时,它不允许radconfirm显示并跳过它 方法如下:Javascript 从onClientClick转换为onClientClick,javascript,c#,asp.net,telerik,Javascript,C#,Asp.net,Telerik,我目前有一个JavaScript方法,查看页面是否经过验证,如果是,允许用户按下create按钮并抛出radconfirm,我遇到的问题是,如果我使用radButton,它工作得很好,但当使用ASP:按钮时,它不允许radconfirm显示并跳过它 方法如下: function ShowConfirm(clickedButton, args) { var validated = window.Page_ClientValidate('POPgroup'); i
function ShowConfirm(clickedButton, args) {
var validated = window.Page_ClientValidate('POPgroup');
if (validated)
{
args.set_cancel(true);
function confirmCallBackFn(arg) {
if (arg == true) {
clickedButton.click();
}
}
var text = "Please make sure all fields are completed correctly as once" +
" accepted the proof of purchase will be submitted and no further " +
"changes will be allowed. Are you sure you wish to continue?";
radconfirm(text, confirmCallBackFn,350,100,null,"Confirm");
}
}
这是按钮:
<asp:Button ID="AddProofOfPurchaseButton" runat="server" Text="Submit"
ValidationGroup="POPgroup" CssClass="claim_header_create_button"
OnClick="AddProofOfPurchaseButton_OnClick" OnClientClick="ShowConfirm(this);
return false;" />
如何更改此代码以使用asp按钮而不是radbutton?还有,为什么会发生这种情况?onClientClick(Telerik)和onClientClick(asp)之间有什么区别?对于其他遇到相同问题的人,我发现我的问题的答案是这样的
function ShowConfirm(button) {
var validated = window.Page_ClientValidate('POPgroup');
if (validated) {
function CallbackFn(arg) {
if (arg) {
__doPostBack(button.name, "");
}
}
var text = "Please make sure all fields are completed correctly as once" +
" accepted the proof of purchase will be submitted and no further " +
"changes will be allowed. Are you sure you wish to continue?";
radconfirm(text, CallbackFn, 350, 100, null, "Confirm");
}
}
按钮如下:
<asp:Button ID="AddProofOfPurchaseButton" runat="server" Text="Submit"
ValidationGroup="POPgroup" CssClass="claim_header_create_button"
OnClick="AddProofOfPurchaseButton_OnClick" OnClientClick="ShowConfirm(this); return false;" />
几天前,我也遇到了这个问题。实际上,默认情况下,Radbutton为自动回发设置了true,因此如果您想在Radbutton中实现这一点!那么, 您需要更改回发属性(稍后可以在jscript中更改)以及原因验证检查
您好,谢谢您的回复我的问题中的代码实际上在radbutton中工作我遇到的问题是让它与asp按钮一起工作,而我发现的问题是“args.set_cancel(true);”停止导航,这是一种telerik方法,因此当然不能与asp按钮一起工作。