Thursday

asp.net treeview javascript search

Backward search:
 

function SearchBack(tv_id,str)
{
var tree = document.getElementById(tv_id);
var treeLinks = tree.getElementsByTagName('A');
eval(' var sel_name = '+tv_id+'_Data.selectedNodeID.value;');
var elem;
var sel_passed=0;
for(var element in treeLinks )
{
var sub1=treeLinks[element].firstChild;

if (sel_name && treeLinks[element].id==sel_name) {
sel_passed =1;
if (!sel_name || sel_passed==1) break;
}
if (sub1 && (''+sub1.value).indexOf(str) >=0)
{
//log("found"+treeLinks[element].id);
elem=treeLinks[element];
}
}

if (elem) {
eval('TreeView_SelectNode('+tv_id+'_Data,elem,"'+elem.id+'");');
elem.focus();
}else{
alert('Not found');
}
}


Forward search:
 

function SearchForward(tv_id,str)
{
var tree = document.getElementById(tv_id);
var treeLinks = tree.getElementsByTagName('A');
eval(' var sel_name = '+tv_id+'_Data.selectedNodeID.value;');
var elem;
var sel_passed=0;
for(var element in treeLinks)
{
var sub1=treeLinks[element].firstChild;
if (sub1 && (''+sub1.value).indexOf(str) >=0)
{
//log("found"+treeLinks[element].id);
elem=treeLinks[element];
if (!sel_name || sel_passed==1) break;
}

if (sel_name && treeLinks[element].id==sel_name) {
sel_passed =1;
}
}
if (elem) {
eval('TreeView_SelectNode('+tv_id+'_Data,elem,"'+elem.id+'");');
elem.focus();
} else{
alert('Not found');
}


}

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...