In the past, I did not pay attention to the small property of autoeventwireup, but later I had to study it and finally understood it because of its troubles.
If you write an Asp.net page that contains the server script:
<@ Page Language = C # autoeventwireup = "false" inherits = "chapter3.ch21" %>
<HTML>
<Script language = C # runat = Server>
Void page_load (Object sender, eventargs E)
{
Lblmessage. Text = "<a href = 'HTTP: // techmango.com '> thinking in techmango.com </a> ";
}
</SCRIPT>
<Body>
<Form runat = Server>
<Asp: Label id = lblmessage runat = server/>
</Form>
</Body>
</Html>
After running, the results are not displayed. Why ?! Of course, it is because autoeventwireup is set to false.What does autoeventwireup mean?CodeWhat is the impact. I checked msdn.AutoeventwireupIndicates whether the page events are automatically connected to the network. If event auto-connection is enabledTrueOtherwiseFalse.
I searched Google again and found a simple and clear answer:
If the autoeventwireup attribute of the page command is set to true (or if this attribute is missing because it is set to true by default), the page framework automatically calls the page events, namely the page_init and page_load methods. In this case, no explicit handles clause or delegation is required.
WhenAutoeventwireupIf this parameter is set to true, the server-side script in HTML is executed and the result is displayed on the page!
But! Conversely,WhenAutoeventwireupIf it is set to false, it is advantageous. Why? Of course, because we often use post-code technology, ifWhenAutoeventwireupIf it is true, the page will be executed twice ,.. NET environment will execute once to run the server-side scripts contained in HTML, and once again to execute the various functions in the code.