PostBack and events

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi,

I'm having a page with:

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

containing the body of my source code.
And also a button with the onclick event:

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click

If I click the button the debugger is stopping at the
Page_Load function instead at Button1_Click! Why this? I
expected it to stop at Button1_Click, changing a value and
then loading the page again by using
Server.Transfer(webform1.aspx) !

I hope somebody can help me!

Thanks in advance

Steve
 
Steve said:
Hi,

I'm having a page with:

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

containing the body of my source code.
And also a button with the onclick event:

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click

If I click the button the debugger is stopping at the
Page_Load function instead at Button1_Click! Why this? I
expected it to stop at Button1_Click, changing a value and
then loading the page again by using
Server.Transfer(webform1.aspx) !

I hope somebody can help me!

Thanks in advance

Steve

The Page_Load even will fire "before" your Button1_click event. It is does
not go to the click event after the Page_Load event, then you may check to
make sure your event hook it still set correctly.
 
I hope this is not duplicated, I posted a reply but did not see it show up
while others did. So if this is a duplicate, sorry!
 
Back
Top