Welcome to Dream.In.Code
Become an Expert!

Join 150,052 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,709 people online right now. Registration is fast and FREE... Join Now!




TreeView Leaf Node Click event

 
Reply to this topicStart new topic

TreeView Leaf Node Click event

PsychoCoder
8 Feb, 2008 - 02:22 PM
Post #1

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
I have a TreeView in my ASP.Net application that is populating the users media library based on the directory they provide, that is completed. I have a CheckBox for each LeafNode, this is for creating a Windows Media Player Playlist (.wpl file). There is no, from what I can tell, a checked event for the leaf nodes checkboxes. I can access the selected items with a foreach loop


CODE

foreach (TreeNode node in MediaLibrary.CheckedNodes)
{

}



But I was wondering how I can capture that when each CheckBox is checked so I can populate a Repeater in an AJAX UpdatePanel with each song that is selected, as it is selected. I have a Save button that creates the file when the user is finished selecting their songs, I'm just wanting a way to show them in a separate list as they select them.

Does anyone know of a way to capture each song as they are checked? I'm tired of beating my head against the wall lol
User is offlineProfile CardPM
+Quote Post

skaoth
RE: TreeView Leaf Node Click Event
8 Feb, 2008 - 03:29 PM
Post #2

D.I.C Regular
Group Icon

Joined: 7 Nov, 2007
Posts: 357



Thanked: 12 times
Dream Kudos: 100
My Contributions
I assume you are using a Treeview?
If you are the nodes can be attached to a event handler. If I look at the
events of the treeview control there is one called "TreeNodeCheckedChanged"

However, after reading the docs on it, it looks like the issue is that a post back is not
generated when you click on the checkbox. The event handler for the check boxes will execute
after a postback via some other means.

This means you'll have to trigger the postback via javascript
http://forums.asp.net/p/1109288/1888180.aspx
has an example.

Cheers.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: TreeView Leaf Node Click Event
8 Feb, 2008 - 08:27 PM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Well this was a dead end, the TreeView isn't compatible with the AJAX UpdatePanel. Back to drawing board lol
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:18PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month