Solved

SelectAll/UnselectAll checkboxeList items on a webform without postback

Posted on 2006-06-16
1
472 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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 this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

26 Experts available now in Live!

Get 1:1 Help Now