The Web Forms Events Model - Web Forms in C# Part 3

Naimishforu
Posted by in C# category on for Beginner level | Points: 150 | Views : 5044 red flag
Rating: 5 out of 5  
 1 vote(s)

We will look into The Web Forms Events Model
Because of the disconnected nature of the Web, the events raised in ASP.NET Web Forms function differently from events in standard Windows GUI applications.

This is because the events are fired within the client browser but are transferred to the web server via an HTTP POST. There they are handled by the ASP.NET page framework.

The ability of the ASP.NET runtime server engine to handle events raised on the client significantly simplifies the development of interactive web applications. You develop your event-handling routines in the same way as you do in Windows Forms applications.

Because the server is remote (and events need a round trip to the server), the performance of event handling suffers.

Many mouse-moving events, which have to tie into server code, are not practical in a web model. So the number of built-in events on offer is limited.

However, server controls generally offer an event to signal that their contents have changed. For instance, TextBox has a TextChanged event and CheckBox has a CheckChanged event. 

The handling of these events is postponed until the next round trip to the server. The specific part of the event-management model where events are captured on the client and are sent together to the server via a single HTTP POST is called the postback event model.

Some higher-level events are raised by ASP.NET. These include session events and application events. 

The user-session events are Start, indicating the start of an application session, and End, meaning the end or timeout of a session.

The Application object offers many public events such as BeginRequest and EndRequest, indicating the start and the end of an HTTP request associated with a web application.

Handlers for the session and application events are coded in the Global.asax page.

Thanks and Have Fun!!!!!

Page copy protected against web site content infringement by Copyscape

About the Author

Naimishforu
Full Name: Naimish Pandya
Member Level: Bronze
Member Status: Member,MVP
Member Since: 1/22/2011 7:38:35 AM
Country: India
Thanks, Naimish http://dotnetinterview.zxq.net/ http://naimishpandya.blogspot.in/
http://naimishpandya.blogspot.in/

Login to vote for this post.

Comments or Responses

Posted by: Madhu.b.rokkam on: 2/15/2011 | Points: 25
Nice article :)
Posted by: Naimishforu on: 2/15/2011 | Points: 25
Thanks Madhu :)

Login to post response

Comment using Facebook(Author doesn't get notification)