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

Page refresh on button click

1 Answer 264 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Krishna
Top achievements
Rank 1
Krishna asked on 22 Sep 2008, 09:19 AM
Hi ,

I am using RadAjax panel in my application.I embed the id in the RadAjaxManager control.But when I click on the button the page is getting refreshed.In the button properties onclientclick event I called a javascript function.Please provide a solution for this issue the page should not get refreshed when I click on the button.

Thanks,
Krishna Kumar.A

1 Answer, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 22 Sep 2008, 02:08 PM
Hello Krishna,

When using the OnClientClick property, you must return a value of false in order to run the script and not post back to the server. Try doing something like this:

<telerik:RadScriptManager ID="RadScriptManager1" Runat="server" /> 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    <script type="text/javascript"
        function Click() { 
            // insert functionality here 
            return false; 
        } 
    </script> 
</telerik:RadCodeBlock>    
 
<asp:Button ID="Button1" runat="server"  
    Text="Click Me!" 
    OnClientClick="return Click();" /> 

I hope that helps.

Regards,
Kevin Babcock
Tags
Ajax
Asked by
Krishna
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Share this question
or