.NETGURU
TreeView Selected Index
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngwebcontrols' list.


Baijal, VishalX J
Hi All,

I'm using the TreeView control and my requirement is to capture the click
event...
I was trying to use the SelectedIndexChange event but somehow it does not
shoe me anything.
Then I went and made my AutoPostBack to True... So, my control goes into
this event but then entire page is reloaded.

What I need is based on the node clicked by the user I want to capture the
Text and Id values of that Selected Node...
So can someone please help me with the process that I should follow to do
that...

Can I use some ASP.NET - TreeView event or I need to use JavaScript...
Because at the same time I don't want my Tree to get refresh all the time...
Is there any way/event in which I can capture the Text and ID of the
Selected Node in TreeView without using the JavaScript and just by some
ASP.NET event or Do I've to use JavaScript

Thanks,
Vishal Baijal
Reply to this message...
 
    
Thomas Fuller
I had this same conflict with using the TreeView control. If you don't want
the page to refresh on every event you can't use the autopostback but that
means you need to use some type of client side script to capture the click
events. I don't believe there is any way to deal with this outside of using
javascript. There are some good articles on MSDN discussing the client side
functionality of the Treeview control. Of course as soon as you look at
using javascript and client side behaviors you're eliminating your cross
browser support, in fact you're probably limiting yourself to IE 5.5 or
higher.

Here are those articles:

http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevie" target="_blank">http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevie
w_client_ovw.asp
<http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevi
ew_client_ovw.asp>
http://msdn.microsoft.com/workshop/webcontrols/overview/treeview.asp
<http://msdn.microsoft.com/workshop/webcontrols/overview/treeview.asp>

Hope this helps,
Tom

-----Original Message-----
From: Baijal, VishalX J [mailto:Click here to reveal e-mail address]
Sent: Wednesday, July 10, 2002 8:20 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] TreeView Selected Index

Hi All,

I'm using the TreeView control and my requirement is to capture the click
event...
I was trying to use the SelectedIndexChange event but somehow it does not
shoe me anything.
Then I went and made my AutoPostBack to True... So, my control goes into
this event but then entire page is reloaded.

What I need is based on the node clicked by the user I want to capture the
Text and Id values of that Selected Node...
So can someone please help me with the process that I should follow to do
that...

Can I use some ASP.NET - TreeView event or I need to use JavaScript...
Because at the same time I don't want my Tree to get refresh all the time...
Is there any way/event in which I can capture the Text and ID of the
Selected Node in TreeView without using the JavaScript and just by some
ASP.NET event or Do I've to use JavaScript

Thanks,
Vishal Baijal

| [aspngwebcontrols] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngwebcontrols.asp = JOIN/QUIT
Reply to this message...
 
    
ToddC@match.com
I got around it by using an iframe and configure the treeview to use a url
and a target to post into another frame. Of course that limits my browser
options as well.

Least I didn't have to write any JavaScript <grin>

tc

-----Original Message-----
From: Thomas Fuller [mailto:Click here to reveal e-mail address]
Sent: Thursday, July 11, 2002 7:28 AM
To: aspngwebcontrols
Subject: [aspngwebcontrols] RE: TreeView Selected Index

I had this same conflict with using the TreeView control. If you don't want
the page to refresh on every event you can't use the autopostback but that
means you need to use some type of client side script to capture the click
events. I don't believe there is any way to deal with this outside of using
javascript. There are some good articles on MSDN discussing the client side
functionality of the Treeview control. Of course as soon as you look at
using javascript and client side behaviors you're eliminating your cross
browser support, in fact you're probably limiting yourself to IE 5.5 or
higher.

Here are those articles:

http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevie" target="_blank">http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevie
w_client_ovw.asp
<http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevi
ew_client_ovw.asp>
http://msdn.microsoft.com/workshop/webcontrols/overview/treeview.asp
<http://msdn.microsoft.com/workshop/webcontrols/overview/treeview.asp>

Hope this helps,
Tom

-----Original Message-----
From: Baijal, VishalX J [mailto:Click here to reveal e-mail address]
Sent: Wednesday, July 10, 2002 8:20 PM
To: aspngwebcontrols
Subject: [aspngwebcontrols] TreeView Selected Index

Hi All,

I'm using the TreeView control and my requirement is to capture the click
event...
I was trying to use the SelectedIndexChange event but somehow it does not
shoe me anything.
Then I went and made my AutoPostBack to True... So, my control goes into
this event but then entire page is reloaded.

What I need is based on the node clicked by the user I want to capture the
Text and Id values of that Selected Node...
So can someone please help me with the process that I should follow to do
that...

Can I use some ASP.NET - TreeView event or I need to use JavaScript...
Because at the same time I don't want my Tree to get refresh all the time...
Is there any way/event in which I can capture the Text and ID of the
Selected Node in TreeView without using the JavaScript and just by some
ASP.NET event or Do I've to use JavaScript

Thanks,
Vishal Baijal

| [aspngwebcontrols] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngwebcontrols.asp = JOIN/QUIT
| [aspngwebcontrols] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngwebcontrols.asp = JOIN/QUIT
Reply to this message...
 
    
vrushali jagdale
you want to capture the text and id of the selected index at client side then foolow the steps:
include this line in ur page load event in the .vb file
trePanels.Attributes.Add("onselectedindexchange", "return CheckParent();")

include this function in the .aspx file, i have written this to capture parent nodes you can make required changes in the function to capture the text and id:
var checkeventfire;
function CheckParent()
{
if(checkeventfire==false)
{
checkeventfire=true;
return false;
}
var tree;
var treenode;
tree =document.getElementById("trePanels");
treenode=tree.getTreeNode(tree.selectedNodeIndex);
if ( treenode.getChildren().length!=0)
{
alert("Invalid Panel selection - Parent panel");
if((tree.getTreeNode(event.oldTreeNodeIndex)).getChildren().length==0)
{
checkeventfire=false;
if (treenode.getAttribute("expanded")==true)
{
tree.selectedNodeIndex=event.oldTreeNodeIndex;
}
return false;
}
if (event.oldTreeNodeIndex != event.newTreeNodeIndex)
{
tree.queueEvent('onselectedindexchange', event.oldTreeNodeIndex + ',' +event.newTreeNodeIndex);
}
return true;
}
--------------------------------
From: vrushali jagdale
Reply to this message...
 
 
System.Windows.Forms.TreeView




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification