Button causes Form_Load to fire, before Button_Click

P

Paul Aspinall

Hi

I have a form with a button on it.

It seems that when I click the button, it causes Form_load to fire, before
the Button_Click procedure

Does anyone know why??

Thanks
 
D

Duray AKAR

This is the firing order of events:

Page_Init
Page_Load
Button_Click
Page_PreRender
<% %> codes on the aspx page.

If you are trying to avoid calling the same code everytime
the page is posted back use :

if (!Page.IsPostBack)
{
// code to execute just on the first load
}

or

If Not Page.IsPostBack Then
' code to execute just on the first load
End If

Hope It Helps

Duray AKAR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top