By: Dan Hurwitz and Jesse Liberty in Asp.net Tutorials on 2009年02月27日 [フレーム]
ASP was primarily a linear programming model. It had six events, of which only four were commonly used. These were:
ASP.NET, on the other hand, is primarily an event-driven programming model. The application has events, each session has events, and the page and most of the server controls can also raise events. All ASP.NET events are handled on the server. Some events cause an immediate posting to the server, while other events are simply stored until the next time the page is posted back to the server.
Because they are handled on the server, ASP.NET events are somewhat different from events in traditional client applications, in which both the event itself and the event handler occur on the client. In ASP.NET applications, however, an event is typically raised on the client, but handled on the server.
Consider a classic ASP web page with a button control on it. A Click event is raised when the button is clicked. This event is handled by the client (that is, the browser), which responds by posting the form to the server. No event handling occurs server-side.
Now consider an ASP.NET web page with a similar button control. The difference between an ASP.NET button control and a classic HTML button control is primarily that the ASP.NET button has an attribute, runat=server, that adds server-side processing to all the normal functionality of an HTML button.
When the Click event is raised, once again, the browser handles the client-side event by posting the page to the server. This time, however, an event message is also transmitted to the server. The server determines if the Click event has an event handler associated with it, and, if so, the event handler is executed on the server.
An event message is transmitted to the server via an HTTP POST. ASP.NET automagically (that's a technical term) handles all the mechanics of capturing the event, transmitting it to the server, and processing the event. As the programmer, all you have to do is create your event handlers.
Many events, such as MouseOver, are not eligible for server-side processing because they kill performance. All server-side processing requires a postback, and you do not want to post the page every time there is a MouseOver event. If these events are handled at all, it is on the client side.
One of the broad categories of controls available in ASP.NET applications is HTML server controls. These are identical to the classic HTML controls, except that they enable server-side processing. In addition, they are still used for implementing client-side event handling.
If you want a client-side event handler to perform scripted functions, you must supply your own scripting in either JavaScript or VBScript called from the appropriate event handler. For this to work properly, the client browser must support scripting.
As far as ASP.NET is concerned, events are handled on the server, and the result of an event that posts back to the server is that the page is modified and redelivered to the browser.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in Asp.net )
AmbiguousMatchException: The request matched multiple endpoints.
Microsoft.Identity vs Microsoft.IdentityModel.Clients.ActiveDirectory
Getting values from appsettings.json ASP.NET
Pagination in ASP.net core application
Things to note when changing a function to async in your controller
Passing a model globally to all Views in your Asp.net webapp
HttpError is not found in Asp,net core project
Latest Articles (in Asp.net)
Things to note when changing a function to async in your controller
AmbiguousMatchException: The request matched multiple endpoints.
Call an Action in a controller when user clicks a button in View
Button that is only clickable when the checkbox is checked
Pass the same model to multiple views within the same controller
Passing a model globally to all Views in your Asp.net webapp
Pagination in ASP.net core application
Microsoft.Identity vs Microsoft.IdentityModel.Clients.ActiveDirectory
Things to note when changing a function to async in your controller
AmbiguousMatchException: The request matched multiple endpoints.
Call an Action in a controller when user clicks a button in View
Button that is only clickable when the checkbox is checked
Pass the same model to multiple views within the same controller
Passing a model globally to all Views in your Asp.net webapp
Pagination in ASP.net core application
Microsoft.Identity vs Microsoft.IdentityModel.Clients.ActiveDirectory
© 2023 Java-samples.com
Tutorial Archive: Data Science React Native Android AJAX ASP.net C C++ C# Cocoa Cloud Computing EJB Errors Java Certification Interview iPhone Javascript JSF JSP Java Beans J2ME JDBC Linux Mac OS X MySQL Perl PHP Python Ruby SAP VB.net EJB Struts Trends WebServices XML Office 365 Hibernate
Latest Tutorials on: Data Science React Native Android AJAX ASP.net C Cocoa C++ C# EJB Errors Java Certification Interview iPhone Javascript JSF JSP Java Beans J2ME JDBC Linux Mac OS X MySQL Perl PHP Python Ruby SAP VB.net EJB Struts Cloud Computing WebServices XML Office 365 Hibernate