admin 管理员组文章数量: 1086019
I am having trouble to implement the confirm dialog to ask the user to confirm his choice to delete. The RadButton should not postback to the server if the user clicks cancel. The confirm dialog never shows, what am I doing wrong?
<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>
I am having trouble to implement the confirm dialog to ask the user to confirm his choice to delete. The RadButton should not postback to the server if the user clicks cancel. The confirm dialog never shows, what am I doing wrong?
<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>
Share
Improve this question
asked Mar 19, 2012 at 15:11
Jean-François BeaulieuJean-François Beaulieu
4,45522 gold badges77 silver badges113 bronze badges
1 Answer
Reset to default 5Ok, I found out a way described on the telerik website, the 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>
本文标签: javascriptTelerikpreventing postback with RadButton confirm dialogStack Overflow
版权声明:本文标题:javascript - Telerik : preventing postback with RadButton confirm dialog - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744026417a2520712.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论