STOP REFRESHING PAGE ON BUTTON CLICK

Ankita Pandey

Total Post:183

Points:1285
Posted by  Ankita Pandey
 1135  View(s)
Ratings:
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!
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: stop refreshing page on button click

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!