473,614 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Selec tedNodeChanged( ByVal sender As Object, ByVal e
As System.EventArg s) Handles TreeView1.Selec tedNodeChanged
Me.TreeView1.Se lectedNode.Navi gateUrl = Me.TreeView1.Se lectedNode.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*@andrewlaure n.com
Jun 25 '07 #1
2 4255
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 SelectedNodeCha nged event)

2) If option 1) is not possible, you should be able to call
Response.Redire ct() in SelectedNodeCha nged 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.Redire ct(Me.TreeView1 .SelectedNode.T ext + ".aspx")

Thanks again
"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:j3******** ******@TK2MSFTN GHUB02.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 SelectedNodeCha nged event)

2) If option 1) is not possible, you should be able to call
Response.Redire ct() in SelectedNodeCha nged 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
20061
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 unintended side-effect of toggling the expansion of that subtree. Thanks in advance, Brian
6
6717
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 focus to another tab. Clicking on the same already selected node should add/show the tab, however the after select event does not fire as the node is already selected. I trapped the click event of the treeview but that is not node specific. In...
0
1775
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 may not have some subdirectories with the same name. I am not having any problems populating the treeview with the corresponding directory structure when switching between radio buttons. In the treeview's AfterSelect event, I take the path from...
1
3644
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
15357
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 click to make multiple selections. Then when I simply click one item, all previous selections are gone. Thanks in advance.
0
8180
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8130
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8576
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8275
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8429
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1423
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.