Home > DeveloperSection > Forums > stop refreshing page on button click
Ankita Pandey
Ankita Pandey

Total Post:183

Posted on    April-02-2013 2:18 AM


 1 Reply(s)
 897  View(s)
Rate this:
Hi Mindstickians!

I need to make the asp button to not refresh the whole page when I click it.

my code is just to make a picture change to another picture but the index of the picture is set in the page load method. And every time you click the button 

to go to the next picture index, the whole page refreshes and calls the page load method. That then sets the index back to 0.

how can I make the page stop calling the page load method when I click a button

Thanks in advance!


Total Post:604

Posted on    April-02-2013 7:36 AM

Hi Ankita!

set button event property as below

OnClientClick="return false;"
and that will stop it from posting back the page. This will allow you to do whatever it is you need to do. Now, if you're already running JavaScript in that 

click, which it appears you might be, just return false; from that method.

Don't want to miss updates? Please click the below button!

Follow MindStick