关于MagicAjax的用法


  最近,用了一下MagicAjax 觉得不错,使用很简单,经验终结如下:

  1、打开vs 添加 MagicAjax.dll,就会有AjaxPanel 控件,就往上拖东西吧。(简单吧!)
  2、打开web.config 添加:

        <configSections>
           <section name="magicAjax" type="MagicAjax.Configuration.MagicAjaxSectionHandler, MagicAjax"/>
        </configSections>

            <system.web>
               ...
                  <httpModules>
                         <add name="MagicAjaxModule" type="MagicAjax.MagicAjaxModule, MagicAjax"/>
                 </httpModules>
              ...
           </system.web>

       以上两步就可以实现Ajax了,是不是很简单。如果你觉得loading....很难看,接着来。



 3、首先,下载magicAjax源码,拷贝script目录到你的目录里。

4、 打开web.config 添加:

           <magicAjax tracing="false" scriptPath="~/script">
            <pageStore/>
           </magicAjax>

5、 打开script目录,编辑AjaxCallObject.js(在最后)找到并改成下面的,
           .....
                  function CreateWaitElement() {
                      var elem = document.getElementById('__AjaxCall_Wait');
                   if (!elem) {
                             elem = document.createElement("div");
                             elem.id = '__AjaxCall_Wait';
                             elem.style.position = 'absolute';
                             elem.style.height = 17;
                             elem.border = "1px";
                             elem.style.paddingLeft = "3px";
                             elem.style.paddingRight = "3px";
                             elem.style.fontSize = "12px";
                             elem.style.borderColor = "#990000";
                             elem.style.borderWidth = "0";
                             elem.style.borderStyle="solid";
                             elem.style.backgroundColor = "#990000";
                             elem.style.color = "#FFFFFF";
                             elem.innerHTML = "正在加载...";
                             elem.style.visibility = 'hidden';

                        document.body.insertBefore(elem, document.body.firstChild);    
                }
                     waitElement = elem;   
                   }
                    // end wait element
      
           试一下 ,看看效果,怎么出现乱码?别急,接着改。

6、 打开web.config 改
       第一:<?xml version="1.0" encoding= "gb2312" ?>
       第二:添加
                      <globalization
                               requestEncoding="gb2312"
                                responseEncoding="gb2312"
                           />
         
       好,再试试!如何,不错吧!大家可能还有更好的方法,期待高手指点!

 

      
 






你可能感兴趣的:(Ajax)