SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Dec 2008
    0 Post(s)
    0 Thread(s)

    select / unselect all & individual checkbox in gridview

    select / unselect all & individual checkbox in gridview

    i surfed the net & found may links for the same but along with it i need the same to function for multiple grid
    in a page i have a tabcontainer with 6 tabs each having a gridview with checkbox
    need a javascript function to select /unselect the gridview check box
    and alos when a row is checked few cells from the checked row shld be enabled as all the cell on load are disabled

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Christchurch, New Zealand
    104 Post(s)
    4 Thread(s)
    Quote Originally Posted by svibuk View Post
    select / unselect all & individual checkbox in gridview
    You can use the following function to get all of the checkboxes that are within a designated parent area.

    Code javascript:
    function getCheckboxes(parent) {
        parent = parent || document;
        var inputs = parent.querySelectorAll('input'),
            checkboxes = [];
        for (i = 0; i < inputs.length; i += 1) {
            if (inputs[i].type.toLowerCase() === 'checkbox') {
        return checkboxes;
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2011
    0 Post(s)
    0 Thread(s)
    Hi svibuk,

    I assume you want a functionality similar to select all and deselect all.

    If it is not complicated for you then you can go through below steps.

    (Consider it for one tab, you can implement the same for other tabs as well)

    1. In the first column of your grid you will be having the checkboxes.
    2. Add a class to all the checkboxes appearing in the first column
    3. Through jquery you can change the status of those checkboxes using that class name
    PHP Programming Itís more than just writing code


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts