|
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>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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!
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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?
|
|
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
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
Try to place the JavaScript function before the menu instead of after the menu and see if that helps.
Thanks
|
|
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
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
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
|
|