confirm before event

3 posts, 0 answers
  1. Petar
    Petar avatar
    5 posts
    Member since:
    Jul 2012

    Posted 16 May 2013 Link to this post

    Hi

    Is there any posibility that user confirm his action before onclick method start
    somethin like this

    <telerik:RadButton ID="btnEdit" runat="server" OnClientClicked="ConfirmEdit" OnClick="btnEdit_Click"></telerik:RadButton>

    So, I would like that in JS user confirm his action in ConfirmEdit method and after that if he clicked on 'OK' to call btnEdit_Click method on server side

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 May 2013 Link to this post

    Hi Petar,

    You can attach the OnClientClicking client event instead of OnClientClicked to cancel the server-side click based on the Confirm result. Please have a look at the following code I tried which works fine as expected.

    ASPX:
    <telerik:RadButton ID="btnEdit" runat="server" Text="Edit" OnClientClicking="ConfirmEdit" OnClick="btnEdit_Click">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function ConfirmEdit(sender, args) {
            args.set_cancel(!confirm("Are you sure you want to edit?"));
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Petar
    Petar avatar
    5 posts
    Member since:
    Jul 2012

    Posted 16 May 2013 Link to this post

    It work's fine

    Thanks.
Back to Top