|
Rank: Advanced Member Groups: Member
Joined: 10/15/2008 Posts: 45
|
Hi there, I'm trying to utilise ItemClick to set Selected property of Menu Items. As advised in documentation, I enabled RaisesServerEvent for the Menu, but without luck. Menu is contained in a UserControl, which feeds into Application's Index page. Index page has an iFrame where pages load. Consequently, TargetWindow property of Menu Items is set to said iFrame name/ID. Everything is OK except for ItemClick. Here is Menu declaration:
Code: HTML/ASPX
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="globalMenu.ascx.vb" Inherits="TimeApp.globalMenu" %>
<%@ Register TagPrefix="eo" Namespace="EO.Web" Assembly="EO.Web" %>
<div id="menuBar">
<div id="mainMenu">
<eo:Menu
id="globalNav"
runat="server"
width="550px"
RightToLeft="<%$ Resources:General, loc_Prop_RightToLeft %>"
RaisesServerEvent="true"
EnableKeyboardNavigation="True"
ImageBaseDirectory="~/images/nav/Menu/">
<TopGroup Style-CssClass="TopLevel"></TopGroup>
<LookItems>
...
</LookItems>
</eo:Menu>
</div>
...
</div>
And the Handler:
Code: Visual Basic.NET
Protected Sub GetClicked(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles globalNav.ItemClick
MsgBox("I am fired...")
End Sub
Am I missing something here? Regards, Saed Hamdan"Man may be destroyed but not defeated" -Hemmingway
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Check whether you have NavigateUrl set. You won't be able to have post back and NavigateUrl at the same time. Post back comes back to the same Url, while NavigateUrl goes to a different Url.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 10/15/2008 Posts: 45
|
eo_support wrote:Check whether you have NavigateUrl set. You won't be able to have post back and NavigateUrl at the same time. Post back comes back to the same Url, while NavigateUrl goes to a different Url. Already set, and all pages load into iFrame without problems. Anyway, I'm trying working that out via JS, and it sounds working.
Code: JavaScript
function getClicked(e, eventInfo)
{
var isClicked = eventInfo.getItem();
handleSelected(isClicked, true);
}
function handleSelected(thisItem, status)
{
var levels = thisItem.getLevel();
switch (levels)
{
case 1:
thisItem.setSelected(status);
thisItem.getParentItem().setSelected(status);
case 2:
thisItem.setSelected(status);
thisItem.getParentItem().setSelected(status);
thisItem.getParentItem().getParentItem().setSelected(status);
}
}
However, set MenuItems remain selected when clicking other MenuItems. Therefore, I intend to utilise same handleSelected() function to de-select them, since that little smart trick in documentation didn't work:
Code: JavaScript
eventInfo.getItem().setSelected(!eventInfo.getItem().setSelected());
In VB, I would handle that as:
Code: Visual Basic.NET
Dim itemPath As String = "1/2/3"
Dim thisItem As EO.Web.MenuItem = CType(myMenu.FindItem(itemPath), EO.Web.MenuItem)
...
How could I achieve that in JS, especially CType()? Tried the following but got errors:
Code: JavaScript
function clearSelected(passedPath)
{
var mainMenu = document.getElementById('<%= myMenu.ClientID %>');
var wasClicked = mainMenu.findItem(passedPath);
handleSelected(wasClicked, false);
}
Many Thanks in advance. Regards, Saed Hamdan"Man may be destroyed but not defeated" -Hemmingway
|
|
Rank: Advanced Member Groups: Member
Joined: 10/15/2008 Posts: 45
|
Well, any assistant on this?
Thanks.
Regards,
Saed Hamdan "Man may be destroyed but not defeated" -Hemmingway
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
You didn't understand our original reply correctly. We have already pointed out that you can not use NavigateUrl and RaisesServerEvent at the same time and ask you to check NavigateUrl. You replied you do have NavigateUrl set --- that is precisely why RaisesServerEvent is not working for you.
|
|
Rank: Advanced Member Groups: Member
Joined: 10/15/2008 Posts: 45
|
Guess you are right. I thought you meant the opposite OK, what about my ClientSide approach? Could you assist in achieving what I'm up to? Thanks. Regards, Saed Hamdan"Man may be destroyed but not defeated" -Hemmingway
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
You should use eo_GetObject instead of document.getElementById to get our client side menu object.
|
|