$(document).ready(function () {
$('[id^=ContentPlaceHolder1_trv_FakBoln]').change(function () {
AgacdaChkSecildimi();
chkbul();
});
});
function AgacdaChkSecildimi() {
var kimetiklandi = window.event.srcElement;
if (kimetiklandi.type == 'checkbox') {
var cocuklarinolduguDIVIDsi = kimetiklandi.id.replace('CheckBox', 'Nodes');
var div = document.getElementById(cocuklarinolduguDIVIDsi);
if (div == null) return;
var chks = div.getElementsByTagName('INPUT');
for (var i = 0; i < chks.length; i++) {
if (chks[i].type == 'checkbox')
chks[i].checked = kimetiklandi.checked;
}
}
}
function chkbul() {
var listemiz = "";
var inputs = document.querySelectorAll("input[type='checkbox']");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].checked) {
var icIDsi = inputs[i].id.replace("CheckBox", "").replace("ContentPlaceHolder1_trv_FakBoln","ContentPlaceHolder1_trv_FakBolt");
listemiz += "- "+document.getElementById(icIDsi).innerHTML + "<br>";
}
}
document.getElementById("div_secililer").innerHTML = listemiz;
}
function GetSelectedNodes() {
var selected = "";
//Reference the TreeView.
var tree = document.getElementById("<%=TreeView1.ClientID %>");
//Reference the CheckBoxes in TreeView.
var checkboxes = tree.getElementsByTagName("INPUT");
//Loop through the CheckBoxes.
for (var i = 0; i < checkboxes.length; i++) {
//If CheckBox is checked.
if (checkboxes[i].checked) {
//Fetch the Text from the adjacent SPAN element.
var text = checkboxes[i].nextSibling.innerHTML;
//Fetch the Value from the Title(ToolTip) of CheckBox.
var value = checkboxes[i].title;
selected += text + " " + value + "\n";
}
}
if (selected != "") {
alert(selected);
}
return false;
}