I want to perform some operations on the gridview (asp.net 4.0). So, to achieve this i have written a jquery function which i am calling on pageload but, because this function takes some time for execution my grid performance degrades (IE 8). Can i optimize it someway?
$.each($("#divTab2GridInquiries").find("tr").not(":first"), function () {
var tr = $(this);
var val = tr.find("input[id*='hdnLineStatus']").val();
var btnDelete = tr.find("div[id='divBtnDelete']");
var btnTobeDeleted = tr.find("div[id='divBtnTobeDeleted']");
if (val == "N") {
btnDelete.hide();
btnTobeDeleted.hide();
}
if (val == "S") {
tr.css("background-color", "#99FF99");
tr.find("input").css("background-color", "#99FF99");
btnDelete.show();
btnTobeDeleted.hide();
}
if (val == "D") {
tr.css("background-color", "#FFFF99");
tr.find("input").css("background-color", "#FFFF99");
btnDelete.show();
btnTobeDeleted.hide();
}
//From user rights
if ($("input[id*='hdnTab2ShowDelete']").val() != "Y") {
btnTobeDeleted.hide();
//btnDelete.show();
}
});
.each()
, so I'd say:$("#divTab2GridInquiries").find("tr").not(":first").each(function () {
\$\endgroup\$btnTobeDeleted.hide();
? \$\endgroup\$