Ajax.net regression sion

Source: Internet
Author: User

After learning this, let's take out what we need to say in this process.

Let's talk about the version. On the author's website, it is said that ajax.net is no longer developed, and an open-source version is developed based on its version, it mainly adds the ajax control. While
The author re-developed an ajax.net compression sion
Don't understand why. It is still a beta version. I learned this. Now this website seems to have become
Demo, the original page cannot be found, sorry, no link is provided, for an author's blog, http:
// Weblogs.asp.net/mschwarz /.

Regarding copyright and source code, I have discussed it in the yahoo group. Some people say that schwarz never declares whether the software is free, while schwarz says it is free,
He did not know what copyright statement he used, so he did not make it clear. And the source code, just released a few days ago, not the latest version, I have received this source code, but have not carefully read it.
Return to the topic and talk about the gains in the learning process. I declare that I am not a full-time developer and have limited technical skills. The following is a new record.
First, learn about ajax.net Pro. You 'd better check the demo. I have explained its role and usage clearly.

I learned it in the 2.0 environment. There is a difference between 1.1 and, that is, the namespace problem of the corresponding class of web pages. Create a page in vs2005. The default webpage code file does not exist.
There is a namespace declaration, and the demo clearly states that ajax. method needs to be called
Namespace. classname. methodname method. The solution is to modify the webpage and forcibly declare namespace. A later article here
Blog (which is missing, sorry) mentioned that if namespace is not stated, the default is ASP. it is OK to use this namespace.
If you are a newbie, the method object cannot be found in the report during the test, which may be related to this namespace.

Later I encountered another problem. I affirmed a class without a default null parameter constructor. In the js file, I used this class as a method parameter, when the result is called, the error that the constructor cannot be found is always returned.
By mistake, I found the cause of the error after comparing it with the demo for half a day. It seems that there are still many restrictions on class transfer supported by ajax. netPro, but unfortunately there is no better documentation to clarify.
Finally, give me a bit of code, an article, how can I achieve it without code? ) (Most of the following code is copied to the demo, hehe .)
To use ajax. netPro, follow the http://dotnet2.schwarz-interactive.de/quickguide.aspx first
Configure web. config

<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<System. web>
<HttpHandlers>
<Add verb = "POST, GET" path = "ajaxpro/*. ashx" type = "AjaxPro. AjaxHandlerFactory, AjaxPro.2"/>
</HttpHandlers>


[...]

</System. web>
Next, register it on the page.
Protected void Page_Load (object sender, EventArgs e)
{
AjaxPro. Utility. RegisterTypeForAjax (typeof (_ Default ));
}
Add the ajax attribute to the method to be called in js, for example:
[AjaxPro. AjaxMethod]
Public DateTime GetServerTime ()
{
Return DateTime. Now;
}
Finally, you can use this method to call GetServerTime in js:
Function getServerTime ()
{
Alert (MyDemo. _ Default. GetServerTime ();

}
Note: MyDemo. _ Default is the class name of the page. If the namespace is not explicitly stated, it is changed to ASP. _ Default. This call method is actually a synchronous call, that is, the webpage will be suspended until the function returns a value. The author's example is the following asynchronous call method:

Function getServerTime ()
{
MyDemo. _ Default. GetServerTime (getServerTime_callback); // asynchronous call
}

// This method will be called after the method has been executed
// And the result has been sent to the client.

Function getServerTime_callback (res)
{
Alert (res. value );
}
We can see that each [AjaxPro. ajaxMethod] There are two methods called in js, one is synchronization, such as fun (parameter 1, parameter 2 ...), the other is asynchronous, fun (parameter 1, parameter 2 ..., callback_function)
The callback_function parameter is set to res. Unfortunately, except for the value in res, I don't know if there are other attributes. I mentioned url and error in ajax.net, But I didn't test it in ajax. netPro. (To be honest, there are few documents provided by schwarz.) If you have time to read the source code, you will understand it, hehe.
There are many applications in the demo. I will not describe them any more. Let's simply explain the difference between the demo and anthem.
Anthem is mainly used to encapsulate controls. For example, it provides. label, which makes ajax more convenient, and the function call of the custom class seems to be acceptable, but it is clear that only some basic types and dateset can be used as parameters. The usage of ajax. netPro is quite different from that of ajax. netPro. It only provides ajax. method encapsulation calls for custom classes, and many js files are written when used. But I personally like this method and feel more free.
Finally, I would like to thank him for being stingy (ccBoy). His recent post on ajax architecture is very good. (Hehe, that is, he can only understand what he means, that is, the specific technical instructions are not very well understood)

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.