Ajaxpro simplifies. Net ajaxpro

Source: Internet
Author: User

The result returned by the tracing front-end is as follows:
V = {"value": New Ajax. web. dataset ([New Ajax. web. datatable (["ID", "system. string "], [" name "," system. string "], [" dizhou_id "," system. string "], [" sheng_id "," system. string "], [[" 01 "," city jurisdiction "," 01 "," 65 "], [" 02 "," Tianshan District "," 01 ", "65"], ["03", "Sha yibake district", "01", "65"], ["04", "New City", "01 ", "65"], ["05", "shuimogou district", "01", "65"], ["06", "totun district", "01 ", "65"], ["07", "Dalin City", "01", "65"], ["08", "Dongshan District", "01 ", "65"], ["09", "Economic and Technological Development Zone", "01", "65"], ["10", "high-tech industrial development zone ", "01", "65"], ["21", "PiXian", "01", "65"])};
Solution:
This is a bug!
You can solve this problem by modifying the source code.
Specific Method:
1. Download source code
2. Find the "datatableconverter. cs" file under "ajaxpro \ JSON \ converters.
3. Modify row 71st,
If (! Ajaxpro. Utility. settings. oldstyle. Contains ("renderjsoncompliant "))
Put "! "Remove and re-compile.

--------------------------------------------------------------------------
Ajaxpro official website is http://ajaxpro.info, you can download to the latest ajaxpro components. Click here if you want to download it.

In the downloaded file, there is a vs2005 template. After installing the vs2005 template, you can directly create ajaxprowebsite in vs2005. In the created ajaxprowebsite, there is a default demo, in fact, you can fully understand the usage of ajaxpro.

If you use. net2.0 and do not use vs2005. You only need to put ajaxpro.2.dll in the bin folder of the application, and you only need to take the following steps:

1. modify web. config

Add

<System. Web>
<Httphandlers>
<Add verb = "post, get" Path = "ajaxpro/*. ashx" type = "ajaxpro. ajaxhandlerfactory, ajaxpro.2"/>
</Httphandlers>

2. Add the ajaxmethod attribute to your. Net method.

[Ajaxpro. ajaxmethod]
Public datetime getservertime ()
{
Return datetime. now;
}

3. Register JavaScript with the client in the. NET method for using JavaScript

Namespace mydemo
{
Public class _ default
{
Protected void page_load (Object sender, eventargs E)
{
Ajaxpro. Utility. registertypeforajax (this. GetType ());
}

[Ajaxpro. ajaxmethod]
Public datetime getservertime ()
{
Return datetime. now;
}
}
}

4. The syntax for using JavaScript to call the server-side method on the client is also very simple.

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 );
}

In this way, a few simple steps have been completed. The client uses JavaScript to asynchronously call the C # method on the server side and obtain the return value on the server side. This value is passed to Javascript, and javascript can process this returned value, this example is officially provided. The server returns a datetime. However, we can also return complex data types, such as datatable. In short, ajaxpro makes Ajax very simple.

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.