473,770 Members | 3,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding Treeview to Sitemap - Adding dynamic items

Hi all

I have a treeview bound to a sitemap. Once the user is logged in, I'm
wanting the menu to expand to include additional items from a database
while retaining the items in the sitemap. Is this possible.

For example.

My menu has an item called "Books" defined in the sitemap. Once the
user logs in, I want sub menu-items to be created under books with all
the books the user owns. This would be pulled from the database.

Any ideas?

Kind Regards
Ray
May 3 '06 #1
3 2263
The treeview can do this very easily. First, make sure you add some string
to a treenode's Value property that will allow you to determine what node you
are dealing with and what data you need to get out of the database to create
its child nodes. Next, set ExpandDepth to 0, make sure EnableClientScr ipt is
true, and PopulateNodesFr omClient is true. Lastly, add an event handler in
your webpage for the TreeNodePopulat e event. When that event fires, check in
the event args for a treenode. Get the Value from it and retrieve the
specified data from the database. lastly, create child nodes from this data
and add them to this node's .Children property.

All this happens without a postback to the web server; the user just sees a
slight delay and then the nodes come.

"Ray Booysen" wrote:
Hi all

I have a treeview bound to a sitemap. Once the user is logged in, I'm
wanting the menu to expand to include additional items from a database
while retaining the items in the sitemap. Is this possible.

For example.

My menu has an item called "Books" defined in the sitemap. Once the
user logs in, I want sub menu-items to be created under books with all
the books the user owns. This would be pulled from the database.

Any ideas?

Kind Regards
Ray

May 3 '06 #2
Perfect! Thanks for the help.

I'll give it a try.

Regards
Ray
William Sullivan wrote:
The treeview can do this very easily. First, make sure you add some string
to a treenode's Value property that will allow you to determine what node you
are dealing with and what data you need to get out of the database to create
its child nodes. Next, set ExpandDepth to 0, make sure EnableClientScr ipt is
true, and PopulateNodesFr omClient is true. Lastly, add an event handler in
your webpage for the TreeNodePopulat e event. When that event fires, check in
the event args for a treenode. Get the Value from it and retrieve the
specified data from the database. lastly, create child nodes from this data
and add them to this node's .Children property.

All this happens without a postback to the web server; the user just sees a
slight delay and then the nodes come.

"Ray Booysen" wrote:
Hi all

I have a treeview bound to a sitemap. Once the user is logged in, I'm
wanting the menu to expand to include additional items from a database
while retaining the items in the sitemap. Is this possible.

For example.

My menu has an item called "Books" defined in the sitemap. Once the
user logs in, I want sub menu-items to be created under books with all
the books the user owns. This would be pulled from the database.

Any ideas?

Kind Regards
Ray

May 3 '06 #3
Not sure why this is happening but the TreeNodePopulat e event never
fires. The DataBinding and DataBound events fire but not the populate
event.

Also, as I'm binding to a sitemap, I can't set the value of the treenode
as I don't have access to this property.

Any ideas?

Regards
Ray

William Sullivan wrote:
The treeview can do this very easily. First, make sure you add some string
to a treenode's Value property that will allow you to determine what node you
are dealing with and what data you need to get out of the database to create
its child nodes. Next, set ExpandDepth to 0, make sure EnableClientScr ipt is
true, and PopulateNodesFr omClient is true. Lastly, add an event handler in
your webpage for the TreeNodePopulat e event. When that event fires, check in
the event args for a treenode. Get the Value from it and retrieve the
specified data from the database. lastly, create child nodes from this data
and add them to this node's .Children property.

All this happens without a postback to the web server; the user just sees a
slight delay and then the nodes come.

"Ray Booysen" wrote:
Hi all

I have a treeview bound to a sitemap. Once the user is logged in, I'm
wanting the menu to expand to include additional items from a database
while retaining the items in the sitemap. Is this possible.

For example.

My menu has an item called "Books" defined in the sitemap. Once the
user logs in, I want sub menu-items to be created under books with all
the books the user owns. This would be pulled from the database.

Any ideas?

Kind Regards
Ray

May 3 '06 #4

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

Similar topics

1
1437
by: johnb41 | last post by:
I want to create a web.sitemap file that represents a menu, but I just can't figure this out! I need multiple "top level" menu items. Like "Home", "Support", "Contact Us", etc. Under some of these top level items, would be sub items. So in a dynamic menu, the sub item would drop down when moused over. The problem is that .net 2.0 gives an error if I have more than one SiteMapNode directly under the SiteMap tag. For example, I can't...
6
1728
by: Alan Silver | last post by:
Hello, I want to show a treeview display of the contents of a sitemap file on another web site, chosen according to the currently logged on user. I know at run time the path to the sitemap file, but this cannot be determined at design time as it depends who logs in. Can I do this? I can't see how without writing my own provider, which seems like a lot of work for such a simple request?
10
2366
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a top border. Is it possible to have more than 1 style at the same level (parent node) when using a SiteMap? I want it to appear something like this and I can only find a way to either have the border on all root nodes or none at all. In...
2
1640
by: Andy Sutorius via DotNetMonster.com | last post by:
I have a current website divided into 2 sections. Each section needs it's own sitemap and treeview. Is it possible to have 2 different sitemaps in a website? Everything that I have read says you create a web.sitemap file and stick it in your root and connect it to the treeview. I don't see anything about needing 2 web.sitemap files and 2 trees. Thanks for your help. -- Message posted via DotNetMonster.com
5
15074
by: Tim Mackey | last post by:
hi, i have put my web.sitemap in /App_Data so i can edit it programatically via a web admin page, inheriting the modify permissions from the App_Data folder etc. i was hoping the provider would simply persist any changes i made, but it doesn't happen. e.g. selected.ParentNode.ChildNodes.Remove(selected); throws a NotSupportedException "Collection is read-only"
1
2020
by: Robert Dufour | last post by:
In Vs2005 VB.net. How do you localize the title and the description of the pages in the web.sitemap file? For instance in the simple sitemap below <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="Default.aspx" title="Login" description="Login" >
0
1259
by: =?Utf-8?B?TWlrZQ==?= | last post by:
I am using a sitemap (ASP.net 2.0) along with a treeview control to create the navigation for my website. I want to be able to append to url in the site map a sessionID that I use to store member information. Example: Sitemap in web.config contains "home.aspx". When the treeview is rendered, I want the hyperlink to be "home.aspx?sessionID=8484". The sessionID is available in the codebehind and is unique for each user.
4
3179
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
Hi, I am using VB.Net version 2 in a web application. I have a Navigation TreeView that is powered by a SiteMapDataSource linked to Web.sitemap file. This all works well. My questions is, how can I programatically hide a node based upon user roles? Thanks.
0
1313
by: vingomail | last post by:
Good Morning, I have two site map: "common.sitemap, loginuser.sitemap", two master page:" common.master, loginuser.master", in common.master, there is a Navigation control: TreeView TreeView--- Sitemapdatasource---common.sitemap in Loginuser.master, there is another Navigation control: TreeView TreeView---sitemapdatasource---loginuser.sitemap
0
9602
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
9439
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
10071
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
10017
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
9882
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...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
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.