I have a page with repeater in it. The repeater header contains a checkbox and all rows contains check boxes.
I want to select the all the check boxes when i click on the header check box. and i want to remove the headec check, if i uncheck any checkbox.
here is the code.
function UncheckHeader(header) {
$('#divVOIUserPool input:checkbox').each(function() {
if (!$(this).is(':checked')) {
$('#' + header).removeAttr('checked');
}
});
}
function CheckAll(checkbox) {
$('#divVOIUserPool input:checkbox').each(function() {
if (!$(this).is(':disabled')) {
this.checked = checkbox.checked;
}
});
}
Simple i ve put one div as outer to the repeater and named it as 'divVOIUserPoo', and added the properties in repeater item bound. like.
chkSelectValue.Attributes.Add("onClick", "javascript:UncheckHeader('" + ViewState["chkHeaderSelect"].ToString() + "');"); -- for row check boxes in item and alternative item and for header its like--
ViewState["chkHeaderSelect"] = chkHeaderSelect.ClientID;
chkHeaderSelect.Attributes.Add("onClick", "javascript:CheckAll(this);");
in the header of the item bound
I want to select the all the check boxes when i click on the header check box. and i want to remove the headec check, if i uncheck any checkbox.
here is the code.
function UncheckHeader(header) {
$('#divVOIUserPool input:checkbox').each(function() {
if (!$(this).is(':checked')) {
$('#' + header).removeAttr('checked');
}
});
}
function CheckAll(checkbox) {
$('#divVOIUserPool input:checkbox').each(function() {
if (!$(this).is(':disabled')) {
this.checked = checkbox.checked;
}
});
}
Simple i ve put one div as outer to the repeater and named it as 'divVOIUserPoo', and added the properties in repeater item bound. like.
chkSelectValue.Attributes.Add("onClick", "javascript:UncheckHeader('" + ViewState["chkHeaderSelect"].ToString() + "');"); -- for row check boxes in item and alternative item and for header its like--
ViewState["chkHeaderSelect"] = chkHeaderSelect.ClientID;
chkHeaderSelect.Attributes.Add("onClick", "javascript:CheckAll(this);");
in the header of the item bound
No comments:
Post a Comment