473,320 Members | 2,109 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,320 software developers and data experts.

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 2238
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 EnableClientScript is
true, and PopulateNodesFromClient is true. Lastly, add an event handler in
your webpage for the TreeNodePopulate 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 EnableClientScript is
true, and PopulateNodesFromClient is true. Lastly, add an event handler in
your webpage for the TreeNodePopulate 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 TreeNodePopulate 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 EnableClientScript is
true, and PopulateNodesFromClient is true. Lastly, add an event handler in
your webpage for the TreeNodePopulate 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
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...
6
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,...
10
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...
2
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...
5
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...
1
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" ?> ...
0
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...
4
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,...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.