In this blog I have shown how to find the time taken to load a grid after grid bind.
function beforld() {
//alert("hii");
document.getElementById("hdntime").value
= new Date().getTime();
}
function pageloadingtime()
{
document.getElementById("lbl_msg").innerText
= "";
var beforeload =
document.getElementById("hdntime").value;
// alert(beforeload);
//calculate the current time in afterload
var _grid = igtbl_getGridById('<%=
Grid1.ClientID %>');
var row1 = _grid.Rows.getRow(0);
if (document.getElementById("hdntime").value != '') {
//afterload
= (new Date()).getTime();
afterload = new
Date().getTime();
//
alert(afterload);
// now
use the beforeload and afterload to calculate the seconds
//
seconds = (afterload - beforeload) / 1000;
seconds = (afterload - beforeload);
var
daysDifference = Math.floor(seconds / 1000 / 60 / 60 / 24);
seconds -= daysDifference * 1000 * 60 *
60 * 24
var
hoursDifference = Math.floor(seconds / 1000 / 60 / 60);
seconds -= hoursDifference * 1000 * 60
* 60
var
minutesDifference = Math.floor(seconds / 1000 / 60);
seconds -= minutesDifference * 1000 *
60
var
secondsDifference = Math.floor(seconds / 1000);
seconds -= secondsDifference * 1000;
var
milisecondsDifference = Math.floor(seconds);
// If
necessary update in window.status
//
window.status = 'Your Page Load took ' +
seconds + ' second(s).';
// Place
the seconds in the innerHTML to show the results
document.getElementById('lbl_msg').innerText = 'Time
taken = ' + daysDifference + ' day/s '
+ hoursDifference + ' hour/s ' +
minutesDifference + ' minute/s ' +
secondsDifference + ' second/s ' +
milisecondsDifference + ' milisecond/s ';
}
else
document.getElementById("lbl_msg").innerText = "";
}
Here I am taking a grid "Grid1",hidden field "hdntime" and a label "lbl_msg" to show time.