Innovation comes from understanding easy to build your own Ajax framework (1)

Source: Internet
Author: User
Tags error handling interface net new features string client
Ajax|ajax Frame Author: Chen Source: Pole Development Responsible Editor: Ark [2006-03-16 15:01] This article implements only one of the most basic AJAX frameworks. Although Ajax is not a new technology, it is not an article that explains the white This article is just a basic AJAX framework, although AJAX is not a new technology, but as a framework is not an article can explain the white. The purpose of this article: to help beginners learn better and use the AJAX framework.

I always believe that only if you really understand a technology and understand the technology itself can you use it better and more flexibly. A programmer's understanding of technology cannot be confined to the application of technology.

Environment: Window Xp SP2 +. Net framwwork 2.0.50727.

   asp.net 2.0 self-brought client callback

ASP.net 2.0 has been released. 2.0 has many new features, and the client callback is one of them. The client callback allows us to invoke the server-side method without a postback, which is consistent with the functionality provided by Ajax, but not as flexible as Ajax, where Ajax can customize the calling method, with 2.0 of its own callback capabilities.

The System.Web.UI.IcallbackEventHandler interface must be implemented to use the client callback feature.

This interface contains two methods:

Fixed call this method when client callback
public void RaiseCallbackEvent (String eventargument)
This method is called after the raisecallbackevent has been executed. The return value of this method is sent back to the client
public string GetCallbackResult ()

Example one:

. CS:
String cbreference = Page.ClientScript.GetCallbackEventReference (This, "Arg", "receiveserverdata", "context");
String Callbackscript;
Callbackscript = "function CallServer (ARG, context)" + "{" + Cbreference + "};";
Page.ClientScript.RegisterClientScriptBlock (this. GetType (), "CallServer", Callbackscript, True);
Javascript:

See MSDN for more information.
    • Ajax: A new way to build Web apps
    • Discussion on the error handling mechanism of AJAX (2)
    • Discussion on the error handling mechanism of AJAX (1)
    • First experience. NET Ajax Brushless New technology
    • A brief analysis of Ajax development Technology in Rails system (4)


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.