Error On Displaying Confirm Dialog on Button Click

2 posts, 0 answers
  1. Tracy
    Tracy avatar
    118 posts
    Member since:
    Nov 2010

    Posted 01 Apr 2013 Link to this post

    Hi,

    I am trying to display a confirm dialog box on the button click and keep getting an erro 'Object expected' r on the following line.

    radconfirm(text, callBackFunction, 500, 100, null, "Delete Record"

    );
    I am calling the function on the OnClientClicking

    <telerik:RadButton ID="rbtDeleteSetting" runat="server" SkinId="skn_SavedSettings_Delete" EnableViewState="true" OnClientClicking="DeleteOnClientClicking" CommandArgument="Display"/>

    Here is the complete function
    function DeleteOnClientClicking(sender, args)

               {

                   varcallBackFunction= Function.createDelegate(sender, function(argument)

                 {

                     if (argument)

                       {

                            this.click();

                       }

                  });

                 vartext = "Are you sure you want to delete these Saved Settings?<br\>This process CANNOT be un-done.<br\>";

                 radconfirm(text, callBackFunction, 500, 100, null, "Delete Settings");

                 args.set_cancel(true);

              }


    I copied the function from one of the demo's so I am not sure why it doesn't work.

    Thank You
    Tracy
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Apr 2013 Link to this post

    Hi Tracy,

    I was not able to replicate the issue. Please have a look into the following code which displays a confirm box using RadWindow.

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" Text="Delete" OnClientClicking="showConfirmRadWindow"
        OnClick="RadButton1_Click">
    </telerik:RadButton>
    <telerik:RadWindow ID="confirmWindow" runat="server" VisibleTitlebar="true" VisibleStatusbar="false"
        Modal="true" Behaviors="None" Height="150px" Width="300px">
        <ContentTemplate>
            <div style="padding-left: 30px; padding-top: 20px; width: 200px; float: left;">
                <asp:Label ID="lblConfirm" Font-Size="14px" Text="Are you sure you want to Delete?"
                    runat="server"></asp:Label>
                <br />
                <br />
                <telerik:RadButton ID="RadButtonYes" runat="server" Text="Yes" AutoPostBack="false"
                    OnClientClicked="confirmResult">
                </telerik:RadButton>
                <telerik:RadButton ID="RadButtonNo" runat="server" Text="No" AutoPostBack="false"
                    OnClientClicked="confirmResult">
                </telerik:RadButton>
            </div>
        </ContentTemplate>
    </telerik:RadWindow>

    JavaScript:
    <script type="text/javascript">
        function showConfirmRadWindow(sender, args) {
            $find("<%=confirmWindow.ClientID %>").show();
            $find("<%=RadButtonYes.ClientID %>").focus();
            args.set_cancel(true);
        }
        function confirmResult(sender, args) {
            var oWnd = $find("<%=confirmWindow.ClientID %>");
            oWnd.close();
            if (sender.get_text() == "Yes") {
                $find("<%=RadButton1.ClientID %>").click();
            }
        }
    </script>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top