我无法实施确认对话框,要求用户确认他的删除选择。如果用户单击取消,RadButton不应回发到服务器。确认对话框从不显示,我做错了什么?
<script type="text/javascript">
function confirmAspButton(button) {
function aspButtonCallbackFn(arg) {
if (arg) {
__doPostBack(button.name, "");
}
}
radconfirm("Are you sure you want to delete?", aspButtonCallbackFn, 330, 110, null, "Confirm");
}
</script>
<telerik:RadButton
ID="btnDeleteLines"
runat="server"
OnClientClicking="confirmAspButton(this); return false;"
OnClick="btnDeleteLines_Click"
Text="Delete line(s)"
AutoPostBack="false"
GroupName="GroupName1">
</telerik:RadButton>
答案 0 :(得分:5)
好的,我找到了the telerik website上描述的方式CustomRadWindowConfirm
。
<script type="text/javascript">
//Custom RadWindow Confirm
function CustomRadWindowConfirm(sender, args)
{
//Open the window
$find("<%= confirmWindow.ClientID %>").show();
//Focus the Yes button
$find("<%= btnYes.ClientID %>").focus();
//Cancel the postback
args.set_cancel(true);
}
function YesOrNoClicked(sender, args)
{
var oWnd = $find("<%= confirmWindow.ClientID %>");
oWnd.close();
if (sender.get_text() == "Yes")
{
$find("<%= btnDeleteLines.ClientID %>").click();
}
}
</script>
<telerik:RadButton
ID="btnDeleteLines"
runat="server"
OnClientClicking="CustomRadWindowConfirm"
OnClick="btnDeleteLines_Click"
Text="Delete line(s)"
AutoPostBack="false"
GroupName="GroupName1">
</telerik:RadButton>