The Page.IsPostBack Property
The Page_Load subroutine runs EVERY time the page is loaded.
If you want to execute the code in the Page_Load subroutine only the FIRST time the page is loaded, you can use the Page.IsPostBack property of the Page class.
The IsPostBack gets a value that indicates whether
|
⇑ Without if Not Page.IsPostBack ⇓ With if Not Page.IsPostBack
|
demo_pageispostback.aspx |
Web |
|
---|---|---|
|
Submit
button, the submit subroutine will write “Hello World!” to the second label, but the date and time in the first label will not change.
The event OnClick fires when the user clicks the left mouse button on the object.