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

Formview delete confirmation

2 Answers 144 Views
Button
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 20 Jan 2011, 10:26 PM
The radbutton does not support the onclientclick property as outlined below:

<asp:Button ID="Button1" runat="server" CausesValidation="False" 
     CommandName="Delete" Text="Delete"                                    
     OnClientClick="return confirm('Are you certain you want to delete this Customer?')" 
     BackColor="#3333CC" Font-Bold="True" Font-Names="Arial" Font-Size="X-Small" 
     ForeColor="White" />
 <telerik:RadButton ID="RadButton6" runat="server" CausesValidation="False" 
     CommandName="Delete" Text="Delete" Skin="Web20"
     OnClientClick="return confirm('Are you certain you want to delete this Customer?')">
</telerik:RadButton>

The ASP button will present a delete confirmation in a formview. The telerik button will not. Is there a way to get this to work with the Telerik button?

Regards, Lee

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Jan 2011, 06:13 AM
Hello Lee,

The OnClientClicked property of the RadButton control expects the name of the javascript function that will handle the clicked client-side event.
Here is the sample code to achieve the your scenario.

aspx:
<telerik:RadButton ID="RadButton6" runat="server" CausesValidation="False" CommandName="Delete"
            Text="Delete" Skin="Web20" OnClientClicked="OnClientClicked">
</telerik:RadButton>

JavaScript:
<script type="text/javascript">
function OnClientClicked(button, args)
        {
            if (confirm('Are you certain you want to delete this Customer?'))
            {
                button.set_autoPostBack(true);
            }
            else
            {
                button.set_autoPostBack(false);
            }
        }
</script>

Regards,
Shinu.
0
Lee
Top achievements
Rank 1
answered on 21 Jan 2011, 03:55 PM
Thanks Shinu,

It works fine.

Regards, Lee


Tags
Button
Asked by
Lee
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Lee
Top achievements
Rank 1
Share this question
or