转载:
忘了从哪里找到的,是一个国外网站.
只要在</form>后面使用以下代码,就可以加速刷新.
<
script
language
="javascript"
type
="text/javascript"
>
function disposeTree(sender, args) {
var elements = args.get_panelsUpdating();
for ( var i = elements.length - 1 ; i >= 0 ; i -- ) {
var element = elements[i];
var allnodes = element.getElementsByTagName( ' * ' ),
length = allnodes.length;
var nodes = new Array(length)
for ( var k = 0 ; k < length; k ++ ) {
nodes[k] = allnodes[k];
}
for ( var j = 0 , l = nodes.length; j < l; j ++ ) {
var node = nodes[j];
if (node.nodeType === 1 ) {
if (node.dispose && typeof (node.dispose) === " function " ) {
node.dispose();
}
else if (node.control && typeof (node.control.dispose) === " function " ) {
node.control.dispose();
}
var behaviors = node._behaviors;
if (behaviors) {
behaviors = Array.apply( null , behaviors);
for ( var k = behaviors.length - 1 ; k >= 0 ; k -- ) {
behaviors[k].dispose();
}
}
}
}
element.innerHTML = "" ;
}
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(disposeTree);
</ script >
function disposeTree(sender, args) {
var elements = args.get_panelsUpdating();
for ( var i = elements.length - 1 ; i >= 0 ; i -- ) {
var element = elements[i];
var allnodes = element.getElementsByTagName( ' * ' ),
length = allnodes.length;
var nodes = new Array(length)
for ( var k = 0 ; k < length; k ++ ) {
nodes[k] = allnodes[k];
}
for ( var j = 0 , l = nodes.length; j < l; j ++ ) {
var node = nodes[j];
if (node.nodeType === 1 ) {
if (node.dispose && typeof (node.dispose) === " function " ) {
node.dispose();
}
else if (node.control && typeof (node.control.dispose) === " function " ) {
node.control.dispose();
}
var behaviors = node._behaviors;
if (behaviors) {
behaviors = Array.apply( null , behaviors);
for ( var k = behaviors.length - 1 ; k >= 0 ; k -- ) {
behaviors[k].dispose();
}
}
}
}
element.innerHTML = "" ;
}
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(disposeTree);
</ script >