Home
About Me
Categories
C#
(11)
ASP.NET
(34)
JavaScript
(6)
CSS
(1)
XSLT
(1)
Unit Testing
(22)
Architecture
(23)
Ajax
(8)
LINQ to SQL
(2)
ASP.NET MVC
(5)
Life
(18)
Book Reviews
(2)
WPF
(13)
Projects
(2)
Selecting CheckBoxes Inside the GridView Control Using JQuery
published on 5/27/2008 2:26:13 PM
Selecting checkboxes inside the GridView control is a very common operation and that is why I have several articles and videos dedicated to this subject.
Selecting CheckBoxes Inside GridView With a Twist
VIDEO: Selecting CheckBoxes Inside GridView
Recently, I was playing around with JQuery library and thought of implementing the same scenario using the library. Here is the code used to perform the SelectAll and DeSelectAll function.
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
$("#chkAll").click(function()
{
// I don't like this line!
this.checked = !(this.checked == true);
$("#gvCategories input:checkbox").attr("checked",function()
{
this.checked = !(this.checked == true);
});
});
});
</script>
Yup! that's all the code you need to perform this operation. If you think you can even refactor this out then please post your refactorings at
Selecting CheckBoxes Inside the Table
.
Name:
Name:
Email:
Comment/Feedback: