Asp.net|treeview| selected
<asp:treeview id= "TreeView1" runat= "Server" datasourceid= "XmlDataSource1" showcheckboxes= "All" >
<DataBindings>
<script language= "javascript" type= "Text/javascript" >
function client_ontreenodechecked ()
{
var obj = window.event.srcElement;
var treenodefound = false;
var checkedstate;
if (Obj.tagname = = "INPUT" && obj.type = = "checkbox") {
var treeNode = obj;
Checkedstate = treenode.checked;
Todo
{
obj = obj.parentelement;
while (Obj.tagname!= "TABLE")
var parenttreelevel = obj.rows[0].cells.length;
var parenttreenode = obj.rows[0].cells[0];
var tables = Obj.parentElement.getElementsByTagName ("TABLE");
var numtables = Tables.length
if (numtables >= 1)
{
for (i=0 i < numtables; i++)
{
if (tables[i] = = obj)
{
Treenodefound = true;
i++;
if (i = = numtables)
{
Return
}
}
if (Treenodefound = = True)
{
var childtreelevel = tables[i].rows[0].cells.length;
if (Childtreelevel > Parenttreelevel)
{
var cell = Tables[i].rows[0].cells[childtreelevel-1];
var inputs = Cell.getelementsbytagname ("INPUT");
inputs[0].checked = checkedstate;
}
Else
{
Return
}
}
}
}
}
}
</script>