Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 21st, 2009, 12:31 PM
Friend of Wrox
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default TreeView Select help...

I have a treeview that I'm dynamically creating on the page load. When i click the node in the treeview the node is selected and highlighted then in the SelectedNodeChanged event i'm gathering data based on the node value and displaying a modal. Now my issue is that if i close the modal and select the same node again nothing happens, because the node is already selected. So what i have to do is click another node, close the modal then select the node i originally selected to get it to display.

So what I need to figure out is:

How do I reselect a node that has been selected
Unselect that node once I display my modal but then make it look selected so that i can select it again.

I tried the second option but i don't know how to make it not look selected once i do change my node selection.

I'm assuming that on the SelectedNodeChanged even I need to pass the node value then unselect it then use Javascript or something to change the background color to make it look selected. But the issue comes on how to make it not look selected when i do change it?

I hope this isn't too confusing. Any help would be appreciated, I've googled this but with no luck and i'm just having a huge brain fart!
Jason Hall

Follow me on Twitter @jhall2013
Old June 21st, 2009, 01:41 PM
Lee Dumond's Avatar
Wrox Author
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts

Probably the easiest way to deal with this is to include a button as an alternate way to initiate the postback.

This is a common pattern when using dropdown lists that post back on SelectedIndexChanged. There is also a "Go" button to make the postback happen when the same item remains selected.
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

if (this.PostHelpedYou)
The Following User Says Thank You to Lee Dumond For This Useful Post:
alliancejhall (June 21st, 2009)
Old June 21st, 2009, 01:59 PM
Friend of Wrox
Join Date: Nov 2007
Posts: 207
Thanks: 2
Thanked 15 Times in 15 Posts
Default Hmm...

I guess that could work. I don't know if I totally like that solution but it may get me by until I figure something out... Thanks Lee!
Jason Hall

Follow me on Twitter @jhall2013

Similar Threads
Thread Thread Starter Forum Replies Last Post
asp:treeview select node from backend function angshujit ASP.NET 2.0 Basics 0 December 16th, 2008 05:17 AM
Programmatically select a treeview node and expand simsen ASP.NET 2.0 Professional 0 June 23rd, 2008 01:57 AM
How to select a node or text from treeview MacDevv C# 2005 3 September 5th, 2006 05:23 AM
Fill select box and select recordset value markd Classic ASP Databases 1 February 20th, 2006 06:41 PM
asp.net 2.0 treeview select node does not respond vhrao ASP.NET 2.0 Basics 0 February 17th, 2006 05:03 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.