I have a treeView with ShowAllCheckBox property to true, I need to bind a javascript function to each checkbox on their click event.
How to do this can any one suggest ?
I have a treeView with ShowAllCheckBox property to true, I need to bind a javascript function to each checkbox on their click event.
How to do this can any one suggest ?
You can't do it server side w/o re-parsing render output. TreeView does not use Controls collection and renders input elements directly.
You'd have to resort to some form of java script as suggested by gk or traditionally:
<script type="text/javascript" language="javascript">
var inputs = document.getElementsByTagName("input");
for (i = 0; i < inputs.length; i++)
if (inputs[i].type == "checkbox" && inputs[i].name.indexOf("TreeView1", 0) == 0)
inputs[i].onclick = function() { alert('click'); };
</script>