| |

VerySource

 Forgot password?
 Register
Search
View: 722|Reply: 6

Problems caused by the execution of Page_Load

[Copy link]

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-6 13:00:01
| Show all posts |Read mode
Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Place the user code of the initialization page here
        TextBox1.Text = Today.Year.ToString.Trim
 End Sub

The page is initialized, giving TextBox1 an initial value, but the text content of TextBox1 can be changed. The current situation is quite the same. After changing it, click the execute button. The value of TextBox1 is the value given to Page_Load.
The question I want to ask is, when will the Page_Load process be executed?
Reply

Use magic Report

0

Threads

32

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-5-22 14:00:01
| Show all posts
Reply

Use magic Report

0

Threads

32

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-5-22 14:15:01
| Show all posts
If Not Page.IsPostBack The
TextBox1.Text = Today.Year.ToString.Trim
End If
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-5-26 11:45:01
| Show all posts
The method upstairs seems to be asp.net.
Reply

Use magic Report

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-5-26 12:45:03
| Show all posts
Page.IsPostBack property
    Page.IsPostBack is used to check whether the current webpage is loaded for the first time. When the user browses this webpage for the first time, Page.IsPostBack will return False, not True for the first time this webpage is browsed; so when we You can use this property in the Page_Load event to avoid doing some repetitive actions.
Reply

Use magic Report

2

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-5-26 16:15:01
| Show all posts
It's easy to use. It seems that I have seen this instruction before reading and studying, but I don't know when I use it, stupid! Dishes! Thank youymoonerHa.
But there is still no explanation for the execution time of the Page_load process.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-25 12:15:02
| Show all posts
Page_Load will be executed every time the page is submitted or refreshed, that is, it will be executed when you display the page load, if you have a button on the page, after clicking, Page_Load will be executed first, and then the button Events, as for how you want to execute the code in Page_Load, use the IsPostBack property to control.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list