Link to home
Start Free TrialLog in
Avatar of AhmedHindy
AhmedHindyFlag for Egypt

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

    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;
                    }
                }
            }
        }
    

Open in new window

and here is the error msg
User generated image
ps :
this problem occur when the grid has many rows > 900
any help ?!
Avatar of AhmedHindy
AhmedHindy
Flag of Egypt image

ASKER

Had enabled debugging in javascript and here is the error i get
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Avatar of Kelvin McDaniel
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?
User generated imagehere is the error , any help  ?
ASKER CERTIFIED SOLUTION
Avatar of Kelvin McDaniel
Kelvin McDaniel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial