Search:
Namespaces
Discussions
.NET v1.1
Feedback
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/treevi
e" target="_blank">
http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevi
e
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/treevi
e" target="_blank">
http://msdn.microsoft.com/workshop/author/behaviors/library/treeview/treevi
e
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com