Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Treeview Control on click event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ed Dror - 25 Jun 2007 16:30 GMT
Hi there,

Based on Microsoft ASP.NET SDK treeview control binding to northwind
database (Categoried, Products)
I added the following code

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles TreeView1.SelectedNodeChanged
Me.TreeView1.SelectedNode.NavigateUrl = Me.TreeView1.SelectedNode.Text +
".aspx"
End Sub

For example I added Chai.aspx

Everything works fine when you click on sub menue Chai the Chai.aspx appear
But it dosent appear when you click once you need to click twice on the
treeview control to see the Chai page

My question how to make the treeview control function like binding to
regular xml (sitemap) with one click only
I checked almost 10 other samples of treeview binding to database and all of
them need to click twice on the sub menu

Thanks,
Ed Dror
Email: edd@andrewlauren.com
Walter Wang [MSFT] - 26 Jun 2007 07:56 GMT
Hi Ed,

Please note that hyperlink to the target (product) page is rendered to
client and handled by the browser instead of the server-side code; that's
why you only navigate to the target page after you clicked a node second
time: if you hover your mouse cursor on the node the first time, you should
see the navigation target URL is empty then.

Two options to fix this:

1) You can set the NavigateUrl property when binding the Treeview (i.e.,
not set at SelectedNodeChanged event)

2) If option 1) is not possible, you should be able to call
Response.Redirect() in SelectedNodeChanged event to directly instruct the
browser to go to target page.

Let me know if this works or not.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Ed Dror - 26 Jun 2007 16:13 GMT
Walter,

Solution 2 works, I replace the code with
Response.Redirect(Me.TreeView1.SelectedNode.Text + ".aspx")

Thanks again

> Hi Ed,
>
[quoted text clipped - 27 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.