Learn how to a build a cloud-first strategyRegister Now



Posted on 2012-09-19
Medium Priority
Last Modified: 2012-11-05
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
javascript error
ps :
this problem occur when the grid has many rows > 900
any help ?!
Question by:AhmedHindy
  • 2
  • 2

Author Comment

ID: 38417498
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
LVL 11

Expert Comment

by:Kelvin McDaniel
ID: 38417567
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?

Author Comment

ID: 38481426
error msghere is the error , any help  ?
LVL 11

Accepted Solution

Kelvin McDaniel earned 2000 total points
ID: 38514999
It looks to me like the request either never completes or simply takes longer than the allowed timeout. Try setting a breakpoint on the endpoint method the request is trying to hit and see what happens when it receives the request?

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question