Introduction to Asp.net Ajax

Source: Internet
Author: User

This articleArticleJust to illustrate what ajax.net is and what it actually provides for us? For more information about the principles of Ajax, see this chapter to learn about the basic concepts and principles of Ajax. I will not describe Ajax here.
Ajax.net extends the existing Asp.net technology so that you can easily use the hot Ajax technology to become more convenient and convenient. It allows you to easily use Ajax technology without having to learn more about Ajax technical details and make fewer changes to some web development modes. In. NET Framework 3.5, it has been integrated into Asp.net.

Ajax.net 1.0 is a class library that is not integrated into. Net framework2.0. The general concept of a class library is to organize a bunch of related functions intoProgramCentralized (DLL ). Then, you can easily apply the functions (of course, object-oriented ). Then, the ajax.net class library and the Special Class Library include a bunch of Javascript in addition to a DLL file.Code. The biggest contribution of ajax.net is to build a client side class library that can be used in any web development environment ). Think about it too. Ajax uses JavaScript in essence. However, ajax.net does not simply use JavaScript code to encapsulate Ajax functions, but provides a better and more effective client class library. It uses similar object-oriented concepts to greatly expand the original JavaScript.

Ajax.net 1.0 consists of two parts, except the client side Library mentioned above and the so-called server side Library (of course, it is in the form of DLL ). The following figure shows the overall structure of ajax.net 1.0.

 
 

You can clearly see two parts. Here, the client is the client library I mentioned earlier. It provides the following features:

  1. It establishes the concept of client components and controls. All of this is done at the components level.

    Here is a different concept that I need to describe. In general, the concepts of components and controls appear in applications. Generally, applications use various components or controls. But now, how can we have similar concepts for pages? This is what I want to explain. We can no longer regard pages as simple pages for web development under the Ajax concept. One basic idea of AJAX is to put more things on the client. Based on this, ajax.net gives us a new concept, that is, when loading a page, it should be considered as an application being loaded. It's just that this application is no longer an interface we imagined to write in languages like C # and Java. From a different perspective, it is not a bad idea to regard a page as an application (isn't JavaScript capable of building it all ?). The answer has been affirmed by ajax.net. So, you should think about the page as an application when developing Ajax.

  2. It makes it easier for you to operate dom (Document Object Mode) using JavaScript ).

    Dom is a good way to access various objects in the browser. However, using JavaScript to operate on it is not easy. For example, ajax.net provides a lot of more convenient writing methods (actually called shortcuts). For example, $ get ('elementid') is equivalent to document. getelementbyid ('elementid'), for example, I want to know the width and coordinate information of the operated Div. 1. You can use sys. UI. domelement. getbounds ($ get ('elementid ')). X or sys. UI. domelement. getbounds ($ get ('elementid ')). width or sys. UI. domelement. getbounds ($ get ('elementid ')). y.

  3. It extends the original JavaScript and supports the object-oriented concept, that is, if you use it, you can use JavaScript to create namespaces, classes, interfaces, implement inheritance, and create objects.

    The basic types in the original ecology JavaScript have all made necessary extensions. It is more convenient to use. The support for object-oriented concepts makes it easier for people who are familiar with using C # To write JavaScript code. You can imagine...

  4. It makes Asynchronous Server access easier. You only need to control the objects at the corresponding networking level to facilitate the operation. (I personally think that if you are interested in using the original JavaScript to call the remote service is a very troublesome thing, at least it is not very conducive to rapid development)

It is far from clear about all the features of the ajax.net Client Side library. If you want to learn the content mentioned above, I can provide a learning method for your reference.

    1. After all, the client side is written in Javascript, so it is necessary to understand the original JavaScript.
    2. Secondly, ajax.net expands the basic types and concepts of JavaScript, so the next step is to understand this.
    3. Ajax requires you to understand Dom, so it is important to know about it and how to operate it. SYS. UI namespace contains useful classes to help you operate the Dom.
    4. Ajax has no benefit if you cannot operate the asynchronous contact server. It is necessary to understand the basic principles of Ajax. The sys. Net namespace contains all the functions for initiating and managing asynchronous requests.
    5. Page is the concept of application. Do not forget this when you are working with Ajax. The page is no longer a page, and it is converted into a program. A good understanding of SYS. webforms namespaces is necessary.

You can't finish it all. The ajax.net 1.0 instruction document is available at http://www.asp.net/site. It is necessary to download the document.

The above is just half done. It only indicates the status of the client. Ajax.net is a server client architecture, which must describe the functions of the server. Before that, I still need to comment on the client. In my opinion above, you may be able to experience a change, which means you cannot rely on the server to help you with everything. For example, rendering, status change and maintenance, and so on, at least cannot be done in the traditional web method. I personally think this change is huge, and I am not used to server application developers like C. Javascript is a language with no good prompt tools and no object-oriented concepts (more like dynamic languages ).

 

The second part is about the server functions of ajax.net. First of all, this architecture does not change any habits and concepts of server-side development (I don't want to describe this, but it is actually like this ). It provides a set of useful server-side controls, which is a special feature of Microsoft and facilitates many developers and architecture designers.

Controls:

Scriptmanager is a required control. A page that requires Ajax "effects" must contain only one such control. Its function is to help you generate necessary Ajax scripts (JavaScript code segments) to the client, so that you can send asynchronous requests from the client and receive responses to the server without doing anything. Of course, it is more powerful than what I described.

Updatepanel is a handy and easy-to-hate control. It can easily help you implement the control of refreshing and updating interface elements. All you need to do is drag the control into it and put a bunch of controls in its control range. Then, compile the necessary code based on the normal server-side programming logic. It supports the functions of most server-side controls. Very easy to use. I will mention it later.

Upageprogress: When upatepanel initiates an asynchronous request, it will give instructions so that users can know what is going on, which is useful for pages with large data volume or long latency.

Timer: This is a timer that can help you automatically initiate asynchronous requests (for a period of time ).

Service Support:

One idea of AJAX is that the server processes data and the client processes the received and displayed results. Therefore, it supports this idea well. We can establish a WebService on the server to directly interact with the JavaScript code segment of the client. The server is no longer required to process data and be responsible for rendering. It allows us to create services normally or pagemethod on the page and then use the scriptservice or scriptmethod attribute provided by it. The rest of the work is done for you. In fact, this process is similar to the process in which we use the Asp.net application to interact With WebService. It will generate necessary service proxy objects using JavaScript on the client side (ajax.net supports the object-oriented concept. As I mentioned earlier ).

 

To understand Ajax, you must realize that it is a "two-differentiation technology", which requires clients and servers. Traditional web is mainly dependent on server-side technology, while Ajax requires both clients and servers. In terms of programming, we also need to change the idea that the page is an application, the server is also an application, and the ideal is that the two applications interact through communication. However, ajax.net is built on the original Asp.net technology. It is very convenient to use, but we need to change the idea of programming more. We cannot use pure server-side programming to do Ajax.

I am talking about a phenomenon. Updatepanel is easy to use, but it does not reduce the workload of communication and servers. When you click any server control that can result in page PostBack placed in upatepanel, it will work. However, please note that this is still a kind of PostBack, it will lead to the process that the page needs to go through the lifecycle. This means that although the page will not be refreshed, it will still cause the server to recalculate all the page-relatedAlgorithm. If you need to execute a lot of tasks in the page cycle, the task response latency will become longer, even if the page is not updated with the user, it will take a long time to wait for the result to return.

///

/// Complete

///

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.