2009_2_02 how aspnet works

2009_2_02 how aspnet works - Chapter 2 How ASP.NET Works...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 2 How ASP.NET Works And slowly, softly, from above the darkness is unfurled A wondrous curtain loosened on the windows of the world. Then suddenly, like magic, … Ten thousand lights flash out … Alfred Chandler, “Lights along the Mile,” The Oxford Book of Australian Verse, ed. Walter Murdoch, 1918.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 How ASP.NET Works Overview ¾ ASP.NET Event Model ¾ ASP.NET Code Compilation ¾ The Page Class ¾ ASP.NET Application Lifecycle
Image of page 2
3 How ASP.NET Works Event Model ¾ One of the key features of ASP.NET is that it uses an event-based programming model. ¾ In the simple Hello World example, we added a small bit of programming to a method named Page_Load . ¾ This method is an event handler . ¾ An event handler is a method that determines what actions are performed when an event occurs, such as when the user clicks a button or selects an item from a list. ¾ When an event is raised, the handler for that specific event is executed.
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 How ASP.NET Works Event Handlers ¾ In the .NET Framework, all event handlers have a specific method signature, that is, a specific return type and parameters. ¾ Event handlers are always void methods. ¾ Event handlers always accept two parameters: ¾ an object parameter ¾ an EventArgs parameter ¾ (or a subclass of EventArgs , such as CommandEventArgs or ImageClickEventArgs ). protected void Page_Load(object sender, EventArgs e) { }
Image of page 4
5 How ASP.NET Works ASP.NET Event System ¾ The event system in ASP.NET operates in a different manner than in a Windows application or from the event system in browser-based Javascript. ¾ In a Windows application, for instance, events are raised and handled on the same processor. ¾ In contrast, ASP.NET events are raised on the client (the browser) but transmitted to and handled on the server. ¾ Since its event handling requires a round-trip to the server, ASP.NET offers a smaller set of events in comparison to a totally client-based event system.
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon