AhmedHindy
asked on
sys.webforms.pagerequestmanagerservererrorexception
hey all of you ,
I am getting this error when click on button to check all in grid
and that is the code of selecting all
ps :
this problem occur when the grid has many rows > 900
any help ?!
I am getting this error when click on button to check all in grid
and that is the code of selecting all
function CheckAll() {
var frm = document.forms[0];
for (i = 0; i < frm.elements.length; i++) {
if (frm.elements[i].type == "checkbox") {
if (frm.elements[i].checked) {
frm.elements[i].checked = false;
}
else {
frm.elements[i].checked = true;
}
}
}
}
and here is the error msg ps :
this problem occur when the grid has many rows > 900
any help ?!
Well... the error itself is misleading because it's saying the server had an internal problem and couldn't complete the request. More about this in #3 below.
1a. It's a matter of developer choice, but regardless the javascript code is working harder than necessary. If the function is supposed to check all the checkboxes then why evaluate if it's already checked or not? There's no need to do that; simply check them all.
1b. If there is a hard requirement to evaluate the checkboxes and then only change those that aren't already checked I'd suggest using jQuery; it's a proven framework that is guaranteed to bring back only those items that aren't already checked, which will in turn allow your code work more efficiently.
2. I suggest that you put breakpoints in the codebehind to see what's actually happening once the page is submitted.
3. I don't see how the code you've provided is causing the problem described in the error. That is a server error, which has no direct connection to the code presented. Does a method further in the chain actually submit the form to the server after checking the boxes?
1a. It's a matter of developer choice, but regardless the javascript code is working harder than necessary. If the function is supposed to check all the checkboxes then why evaluate if it's already checked or not? There's no need to do that; simply check them all.
1b. If there is a hard requirement to evaluate the checkboxes and then only change those that aren't already checked I'd suggest using jQuery; it's a proven framework that is guaranteed to bring back only those items that aren't already checked, which will in turn allow your code work more efficiently.
2. I suggest that you put breakpoints in the codebehind to see what's actually happening once the page is submitted.
3. I don't see how the code you've provided is causing the problem described in the error. That is a server error, which has no direct connection to the code presented. Does a method further in the chain actually submit the form to the server after checking the boxes?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Microsoft JScript runtime error: Sys.WebForms.PageRequestMa