<script type="text/javascript">
function
MakeRadio() {
var tv
= document.getElementById("<%= TV.ClientID %>");
var
chkArray = tv.getElementsByTagName("input");
for (i
= 0; i <= chkArray.length - 1; i++) {
if
(chkArray[i].type == 'checkbox') {
chkArray[i].type = 'radio';
}
}
}
window.onload = MakeRadio;
function
OnTreeClick(evt) {
var src
= window.event != window.undefined ? window.event.srcElement : evt.target;
var
isChkBoxClick = (src.tagName.toLowerCase() == "input"
&& src.type == "radio");
if
(isChkBoxClick) {
SelectOne(src.id);
}
}
function
SelectOne(objId) {
var tv
= document.getElementById("<%= TV.ClientID %>");
var
chkArray = tv.getElementsByTagName("input");
for (i
= 0; i <= chkArray.length - 1; i++) {
if
(chkArray[i].type == 'radio') {
if
(chkArray[i].id != objId) {
chkArray[i].checked = false;
}
}
}
}
</script>
<asp:TreeView ID="TV"
runat="server"></asp:TreeView>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
TV.Attributes.Add("onclick", "OnTreeClick(event)")
End Sub
No comments:
Post a Comment