|
Rank: Newbie Groups: Member
Joined: 11/12/2008 Posts: 6
|
I have a tree menu. + Menu A |- Sub Menu 1 |- Sub Menu 2 |- Sub Menu 3 + Menu B |- Sub Menu 4 |- Sub Menu 5 |- Sub Menu 6 + Menu C |- Sub Menu 7 |- Sub Menu 8
When a user clicks on Menu, I want to automatically display the first sub menu. I have got the code to work to the point where if you click on Menu, it will fire the event and highlite Sub Menu. if (e.TreeNode.IsLeafNode) { lblMsg.Text = string.Format("Menu item '{0}' was clicked.", ((EO.Web.TreeNode)e.NavigationItem).Text); } else { e.TreeNode.Selected = false; e.TreeNode.ChildNodes[0].Selected = true; } Even though the sub menu is now highlited, the content is not being displayed. Any suggestions?? I was hoping to see an on_click event or something on the menu's but dont seem to get around this.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
It doesn't. Selected and Click are two different things. Setting a node as Selected does not automatically carry out what it supposes to do when it is clicked. So you would need to do that by yourself. For example, if you original logic is to load PageA when "Sub menu 4" is clicked, you would the following when "Menu B" is clicked:
1. Select "Sub menu 4" (as you are already doing); 2. Load PageA;
Hope this helps.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 11/12/2008 Posts: 6
|
So, is there a way I can recursively call the same function to achieve that?
private void tvMenu_ItemClick(object sender, EO.Web.NavigationItemEventArgs e) { if (e.TreeNode.IsLeafNode) { lblMsg.Text = string.Format("Menu item '{0}' was clicked.", ((EO.Web.TreeNode)e.NavigationItem).Text); } else { e.TreeNode.Selected = false; e.TreeNode.ChildNodes[0].Selected = true; // recursively call the same function.. since I know at this stage it is going to be a IsLeafNode will be true. But every time I try to call the same function, I can get the EO.Web.NavigationItemEventArgs e parameter... keeps crashing on this!! } }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Sure you can. But you need to have a clear picture about the interface between our control and your code. In another word, where we stop and where you pick up. In this case, the control calls your tvMenu_ItemClick when a node is clicked and we tell you which node is clicked. That's all we provide to you in this case, so if you every falsely assumed that there is more than that, then you run into trouble. :)
The best resource for you to understand what we provide to you is the reference section of the documentation. It tells you everything that is available to you.
Thanks
|
|