Leading technology: ASP.net representation mode

Source: Internet
Author: User

This column is based on a pre-release version of the ASP.net MVC Framework. All information is subject to change.

In layered Web applications, the presentation layer is as important as navigation logic, business logic, and data access. You should try to isolate the presentation layer (usually the presentation logic) from the UI technology and platform, although this is not easy to do. Design patterns can help you achieve this goal.

In this month's column, I'll describe some of the design patterns that are used to build the ASP.net presentation layer. The first thing I want to introduce is the model-view-controller (MVC) pattern (the root pattern for all specialized UI-oriented schemas) and its asp.net applicability beyond the scope of the ASP.net MVC framework.

Deep understanding of ASP.net event handlers

The ASP.net presentation layer consists primarily of. aspx pages that match the HTTP run-time environment. Sometimes, a typical. aspx page may make an HTTP request based on the actions of a particular user, such as a button click or List selection. In asp.net Web forms programming, these events are typically handled sequentially by methods and event handlers, and then written in the page's code-behind class. On the surface, user actions and system reactions seem to be directly connected, which may be true in desktop applications, but not in asp.net.

In ASP.net, a lot of things happen from the time the user clicks to the Display update page, regardless of whether you are currently using AJAX, but in the ASP.net application that you build with the ASP.net MVC Framework, the flow of information is shorter.

Let's look at a button click event. The developer handles this event by writing some code in the Click event handler of the Button control. These codes exist in the source code of the page, as follows:

void Button1_Click (object sender, EventArgs e)
{
//perform any required action
}

You can put all the code that you need to do here, or you can group all of these code in a static method or an instance method exposed by an object:

void Button1_Click (object sender, EventArgs e)
{
//Static method bound to the user action
actionmanager.b Utton1clicked ();
}

You can also organize code that responds to users ' activities in the Controller and operations:

void Button1_Click (object sender, EventArgs e)
{
//Static method bound to the user action
Thispagec    Ontroller controller = new
Thispagecontroller ();
Controller.  Button1clicked ();
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.