Page_load when I click on a button ?!

  • Thread starter Thread starter Christian Ista
  • Start date Start date
C

Christian Ista

Hello,

On a page I have a button, I treat the event click of this button. Is it
normal before I treat the method myButton_click I pass throught the
Page_load event ?

That's mean what, when I start the page ... Page_load .. normal when I click
on the button Page_load again anf after myButton_click

Christian,
 
Yes it is normal.

Wrap your code in the Page_load event that you only want to execute once in
and If block

If Not Page.IsPostBack Then

End If
 
yes that is normal because you are posting back to the server and reloading
the page... use
the IsPostBack function to determin if its a postback or a new page load to
ignore any thing you dont want processed on a postback
 
Yes, it is normal. In ASP.NET pages are not persistent. When a request
comes, the server builds the page, emits the resulting HTML to the browser
and disposes the page. When you click a button, another request is sent to
the server and server build the page again.

Eliyahu
 

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

Back
Top