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

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

3 Answers 813 Views
Button
This is a migrated thread and some comments may be shown as answers.
Okey
Top achievements
Rank 1
Okey asked on 21 Jun 2012, 07:24 AM
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> 

3 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 25 Jun 2012, 10:53 AM
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.
0
MTC
Top achievements
Rank 1
answered on 13 Feb 2013, 07:23 AM
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....
0
Slav
Telerik team
answered on 14 Feb 2013, 06:04 PM
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.
Tags
Button
Asked by
Okey
Top achievements
Rank 1
Answers by
Slav
Telerik team
MTC
Top achievements
Rank 1
Share this question
or