473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Treeview Control on click event

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: ed*@andrewlauren.com
Jun 25 '07 #1
2 4242
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 (wa****@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.

Jun 26 '07 #2
Walter,

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

Thanks again
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:j3**************@TK2MSFTNGHUB02.phx.gbl...
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 (wa****@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.

Jun 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Brian Smith | last post by:
Is there a way to avoid the default action of TreeNode expansion/contraction caused by double click? I can add an event handler to pop up my properties dialog on double click, but it has the...
6
by: Tim | last post by:
Hi I have a form with a treeview on it. When I select a particular node it adds/shows a tab on the form. The treeview node remains selected as it should. The user can close the tab or remove the...
0
by: Treeview Trouble | last post by:
I have an application where there are two radio buttons each of which populates a treeview control with a directory structure. Each radio button corresponds to a different directory which may or...
1
by: Victor Rodriguez | last post by:
Is there a way that I can have a client side event like oncontextmenu="showfunction();" on each node? thanks, Victor
18
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.