How do I use radconfirm with asp:LinkButton's OnClientClick?

5 posts, 0 answers
  1. bemara57
    bemara57 avatar
    57 posts
    Member since:
    Mar 2008

    Posted 23 Apr 2008 Link to this post

    I'm trying to use the radalert instead of the browser confirm alert. Normally I would put this in the OnClientClick: return confirm('Are you sure you want to delete this file?');. But this does not work with radalert. I tried the below but nothing worked, mostly they just show the confirm window and it disappears after a second then the page continues to post without me even answering the confirm question. How do I achieve this?

    OnClientClick="return radconfirm('Are you sure you want to delete this file?', confirmCallBackFn);"
    OnClientClick="radconfirm('Are you sure you want to delete this file?', confirmCallBackFn);"
    OnClientClick="radconfirm('Are you sure you want to delete this file?', confirmCallBackFn); return false;"
    OnClientClick="return radconfirm('Are you sure you want to delete this file?', confirmCallBackFn); return false;"

    <script>
    function confirmCallBackFn(arg)
    {
        return arg;
    }
    </script>
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 25 Apr 2008 Link to this post

    Hello Basem,

    If you do not return false after executing the function in the linkbutton's OnClientClick handler the page will perform a postback and the confirm will not wait until you answer the question. Therefore the correct approach is the following one:

     <asp:linkbutton ID="Linkbutton1" runat="server" OnClientClick="radconfirm('Are you sure you want to delete this file?', confirmCallBackFn); return false;" 
    >LinkButton</asp:linkbutton> 

    Please, try it again and in case it does not work as expected, open a new support ticket and send us a sample project with a detailed explanation of the desired behavior and we will modify it in order to meet your requirements.

    Best wishes,
    Svetlina
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Sharbel Lutfallah
    Sharbel Lutfallah avatar
    26 posts
    Member since:
    Feb 2006

    Posted 07 May 2008 Link to this post

    I am fighting with the same issue.  True putting return false in the LinkButton will stop the page from posting-back so the cb function can be called, however it will still not give the desired result of posting back if the user clicks the OK in the radconfirm window.

    The flow the OP and I are trying to achieve is this:

    1) user clicks a delete button
    2) radconfirm window comes up and asks to confirm delete
    3) user clicks OK
    4) Page continues with postback because user clicks OK

    This does not work.... i did see some old posts for RadWindow1 regarding putting in some lengthy javascript to simulate a browser confirm(), do we still have to do this with the new ASP.NET AJAX RadWindow?  If so, I really think its a shame...
  4. bemara57
    bemara57 avatar
    57 posts
    Member since:
    Mar 2008

    Posted 07 May 2008 Link to this post

    Check this out: http://www.telerik.com/community/code-library/submission/b311D-gbaga.aspx

    It worked like a charm!
  5. Alice
    Alice avatar
    2 posts
    Member since:
    Feb 2017

    Posted 28 Feb in reply to bemara57 Link to this post

    This page doesn't exist anymore. Can you let me know what is the solution?
Back to Top