Welcome Guest Search | Active Topics | Sign In | Register

Poblem with populateondemand Options
erickantoniorp
Posted: Friday, October 26, 2007 2:27:40 PM
Rank: Newbie
Groups: Member

Joined: 10/26/2007
Posts: 3
Hi, i have 2 treeviews. 1 of them, a simle typical asp treeview, and the other, a eo.web.treeview. Both, are being populated on demand. Although i had defined 2 similar functions for both, when i expand nodes from asp treeview... it works fine, then, i expand eo.web.treeview, and it works fine too, but if i want to expand any other node from asp treeview, it doesn't work. When i debug, the first time i try to expand eo.web.treeview, pass for the correct sub, and the asp treeview too, but next time i try to expand another eoweb.treeview node... it pass through asp treeview function.

These are the declarations :

Private Sub FillEOTREEVIEWNodes(ByVal Origen As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles EOTreeView.ItemPopulate

Private Sub LlenarNodo(ByVal Origen As Object, ByVal e As TreeNodeEventArgs) Handles ASPTreeView.TreeNodePopulate

So what could be happening?

Thanks
eo_support
Posted: Friday, October 26, 2007 3:09:00 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That is normal. :) Generally you should not putting two populating on demand TreeView in the same page --- but if you do, they do work, but in a very mysterious way.

The reason that you are seeing expanding EO.Web.TreeView would trigger ASP.NET TreeView's populate on demand handler is because both TreeViews "replays" all populate on demands actions when the page post back. Consider the following sequence:

1. ASP.NET TreeView loads with a single root node "root";
2. You expand ASP.NET TreeView. This triggers its server side handler and creates new child tree node "child";
3. Now you post back the page (for example, by clicking a button "Button1"). The page is reloaded based on .aspx file. At this point the TreeView only have one single root node "root" as in step 1;
4. ASP.NET TreeView remembers that you have populated once. So it calls populate handler again to re-create child node "child".

Step 4 is a "replay" of step 2. What makes it looks confusing is, while step 2 is directly triggered by user expanding a TreeNode, step 4 is triggered by user clicking a button that doesn't appear to have anything to do with the TreeView at all.

Both ASP.NET TreeView and our TreeView replays when posting back. So when you expand our TreeView, ASP.NET TreeView would try to "replay", and vice versa. This of course gets very confusing very quickly.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.