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"
/>