By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,558 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

Binding Treeview to Sitemap - Adding dynamic items

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.