Solved

SelectAll/UnselectAll checkboxeList items on a webform without postback

Posted on 2006-06-16
1
475 Views
Last Modified: 2012-05-05
I have an checkboxlist on the web form, I want to check/uncheck all the checkboxes with out a postback. ie if I click a particular button the form should not post back and all the checkboxes in the checkboxlist be selected and vice-versa...

Thanks!
0
Comment
Question by:srafi78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
parshu21 earned 250 total points
ID: 16922345
Maybe a script like this will help:

<script language="javascript">
function CheckAllCheckBoxes(Select)
{
      var Frm = document.Form1;
      var actVar  = Select.checked;
      for(i = 0;i<document.Form1.length;i++)
      {
            e = document.Form1.elements[i];
            if(e.type == 'checkbox' )
            {                     
                  var ChkBox=document.getElementById(e.id);
                  e.checked = Select.checked;  
            }                                             
      }
}
</script>

here all u need to do is pass variable "select" as main checkbox object on whose check and uncheck all the other checkboxes shud change.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validating textboxes in red square borders. 2 43
Validation for a field in asp.net 3 31
Need help for captcha 2 42
EF5 How do I stop pre-compiled views? 8 54
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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