This is a migrated thread and some comments may be shown as answers.

Error On Displaying Confirm Dialog on Button Click

1 Answer 87 Views
Button
This is a migrated thread and some comments may be shown as answers.
Tracy
Top achievements
Rank 1
Tracy asked on 02 Apr 2013, 12:11 AM
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

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Apr 2013, 06:53 AM
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.
Tags
Button
Asked by
Tracy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or