Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:51:21+00:00 2026-05-30T18:51:21+00:00

I am using two gridview controls in my aspx page. And I have a

  • 0

I am using two gridview controls in my aspx page. And I have a column of checkbox in both my controls. I am facilitating the user to select/deselect all checkboxes in my both gridviews by providing a checkbox in the header template of both gridviews and using java script functions. below is the code

<script type="text/javascript">
    function UncheckParent(obj) {
        var isUnchecked = obj.checked;
        if (isUnchecked == false) {
            var frm = document.forms[0];
            for (i = 0; i < frm.length; i++) {
                if (frm.elements[i].id.indexOf('chkSelectAllCheckboxes') != -1) {
                    frm.elements[i].checked = false;
                }
            }
        }

    }

    function CheckAll(obj) {
        var row = obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
        var inputs = row.getElementsByTagName("input");
        for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].type == "checkbox") {
                inputs[i].checked = obj.checked;
            }
        }
    }
</script>

But the problem is that once i select or deselect one of such checkboxes all checkboxes in both the gridviews get checked. I can also give a short example of what is happening. Two gridviews gdvwStudents and gdvwTeachers. Both have checkbox column and a check box in header template. using above code when I click header checkbox of gdvwStudents, all checkboxes in gdvStudents and gdvTeachers get selected. Please

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:51:22+00:00Added an answer on May 30, 2026 at 6:51 pm

    This is how I managed it:

            function UnCheckAllContainer(obj) {
            var isUnchecked = obj.checked;
            if (isUnchecked == false) {
                var frm = document.forms[0];
                for (i = 0; i < frm.length; i++) {
                    if (frm.elements[i].id.indexOf('chkSelectAllCheckboxesContainers') != -1
                    ) {
                        frm.elements[i].checked = false;
                    }
                }
            }
        }
    
        function CheckAllContainer(chk) {
            $('#<%=gdvwContainers.ClientID %>').find("input:checkbox").each(function () {
                if (this != chk) {
                    this.checked = chk.checked;
                }
            });
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET GridView control with two asp:CommandField columns that are both using
I'm using two different libraries in my project, and both of them supply a
I've been using ASP.NET (C#) for the past two years. I have learned so
I am learning ASP.NET and I have a master-detail scenario using two GridViews in
I have tried to set up combo boxes in the gridview but all the
Background I have a GridView that builds a table using an ObjectDataSource . This
I am using authentication to enter into a page, after authenticated only the user
I have a Gridview with AutoGenerateColumns=False . I am using a TemplateField to display
I am using two activities. One activity displays images in a GridView and by
i am using devexpress gridview 9.2. i have 2 gridview having 2 colum -->

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.