PostBack and events

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
 
R

Rocky Moore

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.
 
R

Rocky Moore

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!
 

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

Top