RadButton with OnClientClick event (postback set to false) is still posting back...

4 posts, 0 answers
  1. Okey
    Okey avatar
    1 posts
    Member since:
    Jun 2012

    Posted 21 Jun 2012 Link to this post

    I have a radbutton that calls a local javascript function to perform a jquery animation to an object on the screen. I've set the button to not post back (button.set_autoPostBack(false), but the jquery animation is causing a postback to the server. Whenever I remove the jquery portion the postback doesn't occur. I'm new to jquery, but I figured I could call this slide animation without doing a postback.

    The Code:

    <script type="text/javascript">
            //<![CDATA[
            function doThis(button, args)
    {

                button.set_autoPostBack(false);
                $telerik.$("#testing").slideUp(1000, "slideUp", function () { null; });                
            }
            //]]>
    </script> 


     <div id="" class="page_center home_banner_info_block">
         <telerik:RadButton ID="RadButton1" ButtonType="StandardButton" ClientIDMode="Static" runat="server"  Text="RadButton" AutoPostBack="false" OnClientClicked="doThis" >
         </telerik:RadButton>

                <div id="testing" class="white-box" style="width:460px; height:400px; float: left;" >
                <div class="wrap">
                testing
                </div>
                </div>
     </div>
     </div>



        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager> 
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 25 Jun 2012 Link to this post

    Hello Okey,

    It is enough to set the AutoPostBack property of RadButton to false in order to ensure that the control will not perform a postback when clicked. In your case the button control still postbacks because there appears to be an error in your implementation of the OnClientClicked event handler and more specifically the way you are using the jQuery method .slideUp(). Please check the documentation article .slideUp(). As explained, the second parameter this method accepts is indicating which easing function to use for the transition. The one you have specified is not valid (slideUp), so please change it with swing or linear and the problem will be resolved.

    All the best,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. MTC
    MTC avatar
    26 posts
    Member since:
    Jan 2013

    Posted 13 Feb 2013 Link to this post

    Hi
    I have a simple requirement to create a record in Data Base. for this i have some fields on my webpage after filling that fields user can create a record.
    for this i am using RadAjaxPanel,RadScriptBlock,Rad Button,RadAjaxManager and RadAjaxLoadingPanel.
    the flow for creating r record would be:
    -> On button click first i want to call a JavaScript for validation( not asp validation) it returns true for successful validation else false..
    ->if it is true loading panel should appear on the screen and server side code should run.
    -> if it is false then loading panel should not appear JavaScript error message should display..

    Please help....
  5. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 14 Feb 2013 Link to this post

    Hi Shweta,

    Please check this forum thread for additional information on the case. I noticed that you have already reported the same problem there. I would suggest using a single thread for this purpose as the information on the described scenario will be much easier to track if it is gathered in one place. Let us continue our discussion in the linked thread.

    Kind regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top