. Ajax based MVC scheme in net environment

Source: Internet
Author: User

1, the problem background

Now, more and more people are trying to make web development without refreshing based on Ajax, but in the. NET environment, it is not very convenient to apply Ajax, which may be caused by some of the following reasons:

• Because Ajax is based on the nature of JavaScript, developers must be very knowledgeable about JavaScript, at least, its JavaScript ability to achieve the callback return content to the page update, so the threshold for the development of a certain degree of increase

• When the development based on Ajax mechanism, the original based on postback mode, asp.net by the background logic code (MODEL), aspx page (View), Aspx.cs (Controller) of the MVC framework is actually invalid, When callback returns data, either the return content is parsed with JavaScript on the client side to implement the update, or the more complete HTML code must be constructed on the server side, and then the constructed HTML is set to a Page object directly by JavaScript. Obviously, this way, to achieve one of the simplest callback functions, a lot of code, and is relatively messy code, even in the upcoming asp.net2.0 the problem will not be effectively resolved

2. The purpose of this article

The purpose of this paper is to benefit the characteristics of the existing asp.net itself and Ajax features, and to propose an MVC scheme for Web development based on Ajax in the ASP.NET environment to achieve the following main purposes:

· A clear MVC framework for Ajax in asp.net environments

• Reduce the programmer's reliance on excessive JavaScript coding to reduce the programming threshold

• Flexible support for common development methods in AJAX mode

3, problem analysis

How to achieve the above several main purposes?

1 to the XMLHttpRequest for better encapsulation, so that the way to invoke simpler;

2) As far as possible in the server to update the structure of the data, but also to avoid each return data are manually constructed, so, think of the full use of UserControl, by UserControl as "View", corresponding by the Ascx.cs file as " Controller ", this composition of MVC is also relatively clear;

Related Article

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.