Skip to content Skip to sidebar Skip to footer

Telerik : Preventing Postback With Radbutton Confirm Dialog

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

Solution 1:

Ok, 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>

Post a Comment for "Telerik : Preventing Postback With Radbutton Confirm Dialog"