mrinali
mrinali

Reputation: 180

Can we stop Page_Load on button click

I have created a password reset URL. I want that URL to show some alert box if user access that URL more than 3 times(means load that URL more than 3 times).I have set a if condition in Page_Load() function of the page. My problem is on reset button click page_load is calling and increasing the attempt and i want the attempt to increase only on URL load. In page_load i am increasing the attempt by 1 and storing it in db.

I have tried if(!postback) but postBack is True for every url load as well as Button click.

My button code:

 " asp:Button ID="btnReset" runat="server" Text="Reset Password" onclick="btnReset_Click"  /"

Upvotes: 0

Views: 642

Answers (1)

Chandra
Chandra

Reputation: 166

Please place condition in page_load like :

protected void Page_Load(object sender, EventArgs e)
    {
          if(!Page.IsPostBack)
             {

               //Please place your code here

              }
     }

Upvotes: 1

Related Questions