Welcome Guest Search | Active Topics | Sign In | Register

Unable to get the _ItemClick event raised on a treeview Options
thomas
Posted: Tuesday, September 25, 2007 8:53:12 AM
Rank: Newbie
Groups: Member

Joined: 9/25/2007
Posts: 5
I have to be missing something easy here.

I place a new treeview control on a webform.
I hard code some nodes in the designer.
I set the itemclick event with some dummy code so that I can hit a breakpoint.

I run the code and the event is not raised when clicking on the tree.

I really like the ease of use of your components and am ready to purchase them except for this issue.

Regards,
-Thomas
eo_support
Posted: Tuesday, September 25, 2007 9:12:03 AM
Rank: Administration
Groups: Administration

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

You need to set RaisesServerEvent to true. It's false by default.

Thanks
thomas
Posted: Tuesday, September 25, 2007 9:36:41 AM
Rank: Newbie
Groups: Member

Joined: 9/25/2007
Posts: 5
Ok that worked fine.

When I add the treeview to my target application the itemclick does not fire. RaisesServerEvent is set to true. The nodes are dynamically populated.

The following code is executed when populate on demand is fired.
foreach (VSSItem vi in vssItems)
{
node = null;
node = new EO.Web.TreeNode(vi.Name);
node.Text = vi.Name;
node.Value = filepath + "/" + vi.Name;

if (vi.Type == 0) // zero is project level node. Enable populate on demand.
{
node.PopulateOnDemand = true;
}
e.TreeNode.ChildNodes.Add(node);
}

Here is the markup:
<eo:TreeView ID="TreeviewProjects"
runat="server"
Height="250px"
Width="250px"
ControlSkinID="MSDN"
OnItemClick="TreeviewProjects_ItemClick"
OnItemPopulate="TreeviewProjects_ItemPopulate"
RaisesServerEvent="True">
</eo:TreeView>

Thanks,
Thomas
thomas
Posted: Tuesday, September 25, 2007 9:41:46 AM
Rank: Newbie
Groups: Member

Joined: 9/25/2007
Posts: 5
I just noticed that I get the following message at the top of the page when I click on the tree.

TreeView ctl00_ContentPlaceHolder1_TreeviewProjects requires a license. You can purchase a license from http://www.essentialobjects.com/Order.aspx. Please refresh the page to continue. More on license.
eo_support
Posted: Tuesday, September 25, 2007 9:46:33 AM
Rank: Administration
Groups: Administration

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

Which version do you use? When you want dynamic loading to work, you want to make sure that all nodes are there when you post back. For example, if you have populated on demand 100 nodes, then you want to one of them to raises server event, you need to repopulate these 100 nodes on the server side when the page postback, otherwise the TreeView won't be able to find a matching node and it won't fire the event.

Our latest version automatically calls ItemPopulate event when page postback if user has dynamically populated nodes, our early version does not. However, you still want to be very careful when you use this feature. The reason that you use populate on demand is because you have a large TreeView, so if you let it rebuild the TreeView upon post back then it's very counter productive and put huge performance burden on your site.

As such generally you should not enable server event on a TreeView that also has populate on demand enabled. Usually populate on demand is strictly used for navigation purpose.

Thanks
eo_support
Posted: Tuesday, September 25, 2007 9:47:53 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
thomas wrote:
I just noticed that I get the following message at the top of the page when I click on the tree.

TreeView ctl00_ContentPlaceHolder1_TreeviewProjects requires a license. You can purchase a license from http://www.essentialobjects.com/Order.aspx. Please refresh the page to continue. More on license.


That's normal. See here for details:

http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=101

Thanks
thomas
Posted: Tuesday, September 25, 2007 10:09:29 AM
Rank: Newbie
Groups: Member

Joined: 9/25/2007
Posts: 5
I downloaded the eval this morning the file indicates version 4.0.34.2 (EO.Web.dll) Is this the latest version?.

I do have a very large treeview. It gives access to old Visual Source Safe files. (I'm using the treeview to navigate the VSS project structure. Its really just a file browser) Some of the projects are quite large. This is an intranet site used by 100 users max. The populate on demand feature works extremely well. There is no noticeable lag even on a large tree. I just need to get the on click event figured out.

-Thomas
eo_support
Posted: Tuesday, September 25, 2007 10:27:04 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi Tomas,

That is the latest version and it should work. You can test the following scenario:

1. Create a blank form;
2. Put a TreeView into the form, set it's RaisesServerEvent to true;
3. Create a single node for the TreeView, and set it's PopulateOnDemand to true;
4. Handle the TreeView's ItemPopulate event, and put in the following code:

Code: C#
EO.Web.TreeNode node = new EO.Web.TreeNode("test");
e.TreeNode.ChildNodes.Add(node);
node.PopulateOnDemand = true;


5. Handle the TreeView's ItemClick event;

You can then run the page, expand the root node to trigger populate on demand, once the child node "test" is populated, click "test" should:
1. Trigger ItemPopulate event first to re-create node "test" on the server side;
2. Trigger ItemClick event;

Once you get that working, you can then try to compare your code and this test code and see if you can spot anything that breaks it.

Thanks
thomas
Posted: Tuesday, September 25, 2007 11:58:29 AM
Rank: Newbie
Groups: Member

Joined: 9/25/2007
Posts: 5
I found where the break down was occurring. Everything works as intended. Thank you for the help. You have a new customer.

-Thomas
eo_support
Posted: Tuesday, September 25, 2007 12:07:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Cool! Thanks for the update!


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.