Hi c.unfried,
The answer to both of your questions above is yes but you will have to make that happen:
1) To accomplish the first functionality, try the following:
a)put a hidden variable in your page having the treeview( with id="Tree1", say) as:
<input type="hidden" id="hdnTvSelNodeText" runat="server"/>
b)put the below code inside your head tag in .aspx
<script type="text/javascript">
window.onload = function(){
var treeview = document.getElementById("<%=Tree1.ClientID %>");
var treeLinks = treeview.getElementsByTagName("a");
for(i=0;i<treeLinks.length;i++)
{
if(treeLinks[i].firstChild.tagName != "IMG")
{
treeLinks[i].onclick =function(){
document.getElementById("<%=hdnTvSelNodeId.ClientID%>").value = this.innerText;
}
}
}
}
c)put the following code in your page load as:
protected void Page_Load(object sender, EventArgs e)
{
if (Tree1.SelectedNode != null && Tree1.SelectedNode.Text == hdnTvSelNodeId.Value)
{
Tree1_SelectedNodeChanged(sender, e); //this is the event handler for the OnSelectedNodeChanged event
}
That's all for this case.
2)For the solution to the second problem:
a)put a hidden variable in your page having the treeview( with id="Tree1", say) as:
<input type="hidden" id="hdnTvSelNodeText" runat="server"/>
b)put the below code inside your head tag in .aspx
<script type="text/javascript">
window.onload = function(){
var treeview = document.getElementById("<%=Tree1.ClientID %>");
var treeLinks = treeview.getElementsByTagName("a");
for(i=0;i<treeLinks.length;i++)
{
if(treeLinks[i].firstChild.tagName != "IMG")
{
if(document.getElementById("<%=hdnTvSelNodeId.ClientID%>").value == treeLinks[i].innerText)
{
treeLinks[i].setAttribute("href","javascript:void(0);");
}
treeLinks[i].onclick =function(){
document.getElementById("<%=hdnTvSelNodeId.ClientID%>").value = this.innerText;
}
}
}
}
That's all for the second case.
Note that above two cases are mutually exclusive.
Hope this helps.
cheers!!
Home Is Where the Wind Blows
http://pushpontech.blogspot.com