set_autoPostBack false and true not posting back

2 posts, 0 answers
  1. Frank
    Frank avatar
    24 posts
    Member since:
    Nov 2010

    Posted 31 Oct 2014 Link to this post

    Since we updated our RadControls to the latest version, we noticed the clientside set_autoPostBack functionality has changed.

    If you want a confirmation from the user before the button is posted, we set the autopostback to false. Once all is confirmed we put it back on true.

    <head runat="server">
            function ConfirmButton(button, args) {
                if( confirm('Are you sure?'))
        <form id="form1" runat="server">
            <telerik:radscriptmanager runat="server" />
            <asp:Literal runat="server" ID="ltStatus" /><br/>
            <telerik:radbutton id="btnCredit" runat="server" text="DoPostback?" onclientclicked="ConfirmButton" onclick="btnCredit_OnClick" />

    When you confirm, the button doesn't get postbacked.
    Introducing a var with the confirmvalue will work, but why is this ?

        function ConfirmButton(button, args) {
            var setPostback = false;
            if (confirm('Are you sure?'))
                setPostback = true;

    Our previous Telerik Version was 2013.1.504.40

    Thanks in advance

  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 04 Nov 2014 Link to this post

    Hello Frank,

    I would suggest when you want to cancel a postback you use the accepted and officially documented approach - set the set_cancel(true) method of the event argument of OnClientClicking event. See an example in the OnClientClicking help article.

    As for the set_autoPostBack() method, in order to use it in events make sure that this happens at an earlier stage(i.e., the cancellable OnClientClicking  event and not the OnClientClicked event).

    Danail Vasilev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top