Page refresh on button click

2 posts, 0 answers
  1. Krishna
    Krishna avatar
    20 posts
    Member since:
    Jun 2007

    Posted 22 Sep 2008 Link to this post

    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.

    Krishna Kumar.A
  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 22 Sep 2008 Link to this post

    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:

    1 <telerik:RadScriptManager ID="RadScriptManager1" Runat="server" /> 
    2 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    3     <script type="text/javascript"
    4         function Click() { 
    5             // insert functionality here 
    6             return false; 
    7         } 
    8     </script> 
    9 </telerik:RadCodeBlock>    
    11 <asp:Button ID="Button1" runat="server"  
    12     Text="Click Me!" 
    13     OnClientClick="return Click();" /> 

    I hope that helps.

    Kevin Babcock
  3. DevCraft R3 2016 release webinar banner
Back to Top