Learning: Learning magicajax (1)

Source: Internet
Author: User

Make preparations First: Copy ajaxcallobject. js to the script directory under the virtual directory (corresponding to this in the configuration information), add magicajax. DLL to the project (official site address is: http://www.magicajax.net /)

1. Add configuration information to Web. config.

< Magicajax
Outputcomparemode = "Hashcode"
Tracing = "False" scriptpath = "~ /Aspnet_client/magicajax" >
< Pagestore
Mode = "Nostore"
Unloadstoredpage = "False"
Cachetimeout = "5"
Maxconcurrentpages = "5"
Maxpageslimitalert = "False"
/>
</ Magicajax >

<Httpmodules>
<Add name = "magicajax" type = "magicajax. magicajaxmodule, magicajax"/>
</Httpmodules>

2. Use ajaxpannel to implement Ajax functions, which is similar to this in aspx:

<% @ Register tagprefix = "ajax" namespace = "magicajax. UI. Controls" assembly = "magicajax" %>
<Ajax: AjaxPanel id = "ajaxpanel1" runat = "server">
</Ajax: AjaxPanel>

3. Put the control that requires no refreshing into ajaxpannel.

4. Write delegate events for the dragged controls

5. magicajax uses ajaxcall for Refresh processing. This is similar to PostBack, but it is only applicable to controls in ajaxpannel and has a loading indication when calling the callpack. AvailableMagicajaxcontext. Current. isajaxcallDetermine whether it is an ajaxcall event (an event triggered by the client) or useMagicajaxcontext. Current. isajaxcallforpage(Triggered by transfer)

6. To solve Chinese garbled characters, recompileSource codeOpen the magicajaxmodule. CS file and you will see
Protected void application_beginrequest (Object sender, eventargs E)
{
Httpcontext context = (httpapplication) sender). context;

// Init private fields
_ Threadabortexceptionthrown = false;
_ Request = context. request;
_ Response = context. response;

_ Response. contentencoding=System. Text. encoding. getencoding ("Gb2312"); // Add this support for Chinese Characters
//...................................... ....................

7. Many static methods are provided through ajaxcallhelper, but there is no chance to use them.

8. When the browser does not support JS pages, no error or deformation will be reported. This is not bad.

9. I have not tried custom controls yet. I don't know if there will be any problems.

 

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.