Welcome Guest Search | Active Topics | Sign In | Register

eo:Menu -- ClientSideOnItemClick Options
balu
Posted: Tuesday, August 26, 2008 1:54:31 PM
Rank: Member
Groups: Member

Joined: 5/22/2008
Posts: 18
Hi

the on item click event is not fired if i have NavigateUrl="some link"

Code: HTML/ASPX
<eo:Menu runat="server" id="navBar" ControlSkinID="None" SkinID="navBar" RightToLeft="true" ClientSideOnItemClick="MenuItemClickHandler" >
           <TopGroup ItemSpacing="1" >
           <Items >
               <eo:MenuItem Text-Html="Pay Online" NavigateUrl="~/payment/default.aspx" ></eo:MenuItem>
               <eo:MenuItem Text-Html="Administration" NavigateUrl="~/admin/default.aspx" ></eo:MenuItem>
               <eo:MenuItem Text-Html="My Info" NavigateUrl="~/myinfo/default.aspx" ></eo:MenuItem>
               <eo:MenuItem Text-Html="Customer Service" NavigateUrl="~/cs/Default.aspx" ></eo:MenuItem>
               <eo:MenuItem Text-Html="Order" NavigateUrl="~/order/order.aspx" ></eo:MenuItem>
               <eo:MenuItem Text-Html="Search" NavigateUrl="~/default.aspx?pageId=search" ></eo:MenuItem>
               <eo:MenuItem Text-Html="Welcome" NavigateUrl="~/default.aspx" ></eo:MenuItem>
           </Items>
       </TopGroup>
   </eo:Menu>
</div>
<script type="text/javascript" language="javascript">
    function MenuItemClickHandler(e, info) {
        window.alert("Menu item");
    }

</script>
eo_support
Posted: Tuesday, August 26, 2008 2:01:45 PM
Rank: Administration
Groups: Administration

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

That behavior is by design. You either let the menu to do the redirection for you, or you handle everything by yourself. You can not have both. If you do want some action to be performed before navigation, you can set the menu item's Value property instead of NavigateUrl property. That way when your MenuItemClickHandler is called, you can then use window.open(info.getItem().getValue()) to redirect to the target page if necessary.

Thanks!
balu
Posted: Tuesday, August 26, 2008 2:34:47 PM
Rank: Member
Groups: Member

Joined: 5/22/2008
Posts: 18
Hi

I did that but still i ClientSideOnItemClick="MenuItemClickHandler" is not working do i require to do anything else?.

but this is working OnClickScript="MenuItemClickHandler()" on the eo:menuItem

what should i do to activate ClientSideOnItemClick
eo_support
Posted: Tuesday, August 26, 2008 2:39:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
balu wrote:
I did that but still i ClientSideOnItemClick="MenuItemClickHandler" is not working do i require to do anything else


As you have already pointed out, "ClientSideOnItemClick does not work if you set NavigateUrl". So ClientSideOnItemClick does works if you do not set NavigateUrl. Right?
balu
Posted: Tuesday, August 26, 2008 2:42:36 PM
Rank: Member
Groups: Member

Joined: 5/22/2008
Posts: 18
ya i removed the NavigateUrl. it is not working in my page but in the demo it is working.

i even copied the entire menu from the demo and pasted in my app it is not working

i am using 6.0.26.2 dll
balu
Posted: Tuesday, August 26, 2008 2:45:08 PM
Rank: Member
Groups: Member

Joined: 5/22/2008
Posts: 18
ok no i found out. i have the menu in a .ascx page it is not working but if i have it in .aspx page the


ClientSideOnItemClick="MenuItemClickHandler" is working.

do u have any comments on that.
eo_support
Posted: Tuesday, August 26, 2008 2:46:36 PM
Rank: Administration
Groups: Administration

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

Try to place the JavaScript function before the menu instead of after the menu and see if that helps.

Thanks
balu
Posted: Tuesday, August 26, 2008 2:48:04 PM
Rank: Member
Groups: Member

Joined: 5/22/2008
Posts: 18
javascript issue as u have told.

Js should be placed before the menu item.

thanks
balu
Posted: Tuesday, August 26, 2008 2:54:57 PM
Rank: Member
Groups: Member

Joined: 5/22/2008
Posts: 18
Hi

still the issue is

I have Value="~/payment/default.aspx" but the url isnide the value is not resolved to relative path.

eo_support
Posted: Tuesday, August 26, 2008 2:58:06 PM
Rank: Administration
Groups: Administration

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

You will need to call Control.ResolveUrl to resolve that by yourself. MenuItem.Value is an opaque value. The menu keeps whatever you give to it without doing any kind of conversion.

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.