Posted on 2012-09-19
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
    LVL 4

    Author Comment

    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

    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?
    LVL 4

    Author Comment

    error msghere is the error , any help  ?
    LVL 11

    Accepted Solution

    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?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    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…
    Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
    How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now