Reputation: 5670
My situation is like this i have a asp button inside my user control
<asp:Button ID="btnSubmit"
Text="Send Notification" class="submit-btn01" onclick="btnSubmit_Click1" runat="server" />
in my browser when I refresh my page, button click event automatically happens.i cant figure out what is wrong with this..
Upvotes: 0
Views: 2545
Reputation: 152634
Refresh is likely repeating the last action that was performed if it was a POST.
Since the last action was to submit the form using your button that is getting replayed.
Upvotes: 1
Reputation: 667
Your question is a little vague. It sounds like you have one of the following scenarios:
Scenario A:
Scenario B:
For Scenario A;
if you want to avoid the re-postback, you should do a Response.Redirect() to the current page in the btnSubmit_Click1 event handler, as mentioned in more detail here: asp.net prevent form submission twice
For Scenario B;
...if it's scenario B, and the answer to these are no, then I'm very curious to see what the final cause of the problem is as I can't imagine why a page would behave differently between a load and a reload.
Upvotes: 3