Click here to Skip to main content
15,889,536 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I have a data grid which has two template columns (two check boxes).one is Column A,second is Column B. When I click Select All both the item templates check boxes should be checked. when I click SelectCoulmn A the script should check only the items which are under Column A.

Please help me through JQuery.
Posted
Comments
DaveAuld 2-Dec-11 10:12am    
Have you got a sample of the page markup to share? If you do, can you 'improve question' and share it please, it will help to work out what you are doing and make jQuery code generation easier.
Sergey Alexandrovich Kryukov 2-Dec-11 23:21pm    
Select/deselect or maybe check/uncheck? Or focus?
--SA
Sergey Alexandrovich Kryukov 2-Dec-11 23:38pm    
Yes, I see. You mean "checked". In included this in my solution. Please fix the title. Replace "select or deselect" with "check or uncheck".
--SA

1 solution

Below, I mentioned "selection" and "focus" only due to misleading title of the question mentioning "select or unselect". The relevant part of this solution is about "checked" property.



For a control, there is no such concept as selection. If you mean check/uncheck, do this:

JavaScript
$(".myCheckbox").prop("checked", true);
or
JavaScript
$(".myCheckbox").prop("checked", false);


If you mean "focus", do this:
JavaScript
$(".myCheckBox").focus();


There is no such concept as "unfocus". A control element looses focus only when some other control element gets focus.

I tested both methods before posting this answer.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900