1.js
function getTargetElement(evt) { var elem if (evt.target) { elem = (evt.target.nodeType == 3) ? evt.target.parentNode : evt.target } else { elem = evt.srcElement } return elem } var lastC = null; function OnClientTreeNodeChecked(evt) { evt = (evt) ? evt : ((window.event) ? window.event : " "); if (evt == " ") { return; } var obj = getTargetElement(evt); var hasTreeNode = false; if (obj.tagName) { if (obj.tagName == "INPUT" && obj.type == "checkbox") { if (lastC) lastC.checked = false lastC = obj; obj.checked = true; } } }
2.C#
TreeView1.Attributes.Add("onclick ", "OnClientTreeNodeChecked(event)");