Hi, I'm not sure if this is the problem you are facing but normally when you bind event handlers with jquery in a web forms application, the binding is lost during post-backs. If that is the case, you would need to use the "Sys.WebForms.PageRequestManager" object to rebind the events between post-backs. You should try something like this:
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestAddress);
function EndRequest(o, e) {
bindHandlersAddress();
}
function bindHandlers() {
$("[id*=TreeView2] input[type=checkbox]").bind("click", function () {
var table = $(this).closest("table");
if (table.next().length > 0 && table.next()[0].tagName == "DIV") {
var childDiv = table.next();
var isChecked = $(this).is(":checked");
$("input[type=checkbox]", childDiv).each(function () {
if (isChecked) {
$(this).attr("checked", "checked");
} else {
$(this).removeAttr("checked");
}
});
} else {
var parentDIV = $(this).closest("DIV");
if ($("input[type=checkbox]", parentDIV).length == $("input[type=checkbox]:checked", parentDIV).length) {
$("input[type=checkbox]", parentDIV.prev()).attr("checked", "checked");
$("input[type=checkbox]", parentDIV.prev()).prop("indeterminate", false);
} else {
if($("input[type=checkbox]:checked", parentDIV).length == 0) {
$("input[type=checkbox]", parentDIV.prev()).removeAttr("checked");
$("input[type=checkbox]", parentDIV.prev()).prop("indeterminate", false);
}else{
$("input[type=checkbox]", parentDIV.prev()).prop("indeterminate",true);
}
}
}
});
}
$(document).ready(function () {
bindHandlers();
});
</script>