Welcome Guest Search | Active Topics | Sign In | Register

How to write a code on Menu Item Click Event Options
kishore
Posted: Thursday, November 3, 2011 7:31:19 AM
Rank: Newbie
Groups: Member

Joined: 8/20/2011
Posts: 4
Hi
I completely stuck at this point
when I click on the menu Item it showing me Error 'Undefined' is null or not an Object

it showing me error on following line

switch (info.getItem().getValue())

my code is following

<script language ="javascript" type="text/javascript">
function MenuItemClickHandler(e, info)
{
//
switch (info.getItem().getValue())
{
case "Project Leader":
window.open('pldefine.aspx');

break;
case "Project Team":
window.open('plTeam.aspx');
break;
case "hide":
window.open('ViewMile.aspx');
break;
}


}
</script>

plz help me
eo_support
Posted: Thursday, November 3, 2011 9:44:51 AM
Rank: Administration
Groups: Administration

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

Your code is correct. If you still have problem, please try to isolate the problem into a small test page and post the test page. We will try to run the test page at here. As soon as we can see the problem, we should be able to tell you what's wrong.

Thanks!
kishore
Posted: Friday, November 4, 2011 7:59:31 AM
Rank: Newbie
Groups: Member

Joined: 8/20/2011
Posts: 4
hi thanks fro rply

Following is my Source code

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>

<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language ="javascript" type="text/javascript">
function MenuItemClickHandler(e, info)
{

switch (info.getItem().getValue())
{
case "Project Leader":
window.open('pldefine.aspx');

break;
case "Project Team":
window.open('plTeam.aspx');
break;
case "hide":
window.open('ViewMile.aspx');
break;
}


}
</script>
<table style="width: 100%">
<tr>
<td>
&nbsp;</td>
</tr>
<tr>

</td>
</tr>
<tr>
<td>
<eo:Menu ID="Menu1" runat="server" ControlSkinID="None" Width="125px">
<LookItems>
<eo:MenuItem HoverStyle-CssText="color:#F7B00A;padding-left:5px;padding-right:5px;"
ItemID="_TopLevelItem"
NormalStyle-CssText="padding-left:5px;padding-right:5px;">
<SubMenu ItemSpacing="5" OffsetX="-3" OffsetY="3" ShadowDepth="0"
Style-CssText="border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9">
</SubMenu>
</eo:MenuItem>
<eo:MenuItem IsSeparator="True" ItemID="_Separator"
NormalStyle-CssText="width: 1px; height: 1px; background-color:#e0e0e0;">
</eo:MenuItem>
<eo:MenuItem HoverStyle-CssText="color:#F7B00A;padding-left:5px;padding-right:5px;"
ItemID="_Default" NormalStyle-CssText="padding-left:5px;padding-right:5px;">
<SubMenu ItemSpacing="5" OffsetX="3" OffsetY="-4" ShadowDepth="0"
Style-CssText="border-right: #e0e0e0 1px solid; padding-right: 3px; border-top: #e0e0e0 1px solid; padding-left: 3px; font-size: 12px; padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; border-bottom: #e0e0e0 1px solid; font-family: arial; background-color: #f7f8f9">
</SubMenu>
</eo:MenuItem>
</LookItems>
<TopGroup Style-CssText="border-right: #e0e0e0 1px solid; padding-right: 10px; border-top: #cb3e00 2px solid; padding-left: 10px; font-size: 12px; background-image: url(00020005); padding-bottom: 3px; border-left: #e0e0e0 1px solid; cursor: hand; color: #5f7786; padding-top: 3px; font-family: arial">
<Items>
<eo:MenuItem Text-Html="Home">
</eo:MenuItem>
<eo:MenuItem IsSeparator="True">
</eo:MenuItem>
<eo:MenuItem Text-Html="Project">
<SubMenu>
<Items>
<eo:MenuItem Text-Html="Project Leader" OnClickScript="MenuItemClickHandler()">
</eo:MenuItem>
<eo:MenuItem Text-Html="Project Team" OnClickScript="MenuItemClickHandler()">
</eo:MenuItem>
<eo:MenuItem Text-Html="MileStone" OnClickScript="MenuItemClickHandler()">
</eo:MenuItem>
</Items>
</SubMenu>
</eo:MenuItem>
<eo:MenuItem IsSeparator="True">
</eo:MenuItem>


</Items>
</TopGroup>
</eo:Menu>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
</table>

</asp:Content>


Please Reply me
thanks for support
eo_support
Posted: Friday, November 4, 2011 8:30:41 AM
Rank: Administration
Groups: Administration

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

You do it on the Menu level instead of on Menu item level:

Code: HTML/ASPX
<eo:Menu ClientSideOnItemClick="MenuItemClickHandler" ....>
    ....
</eo:Menu>


Thanks
kishore
Posted: Friday, November 4, 2011 11:37:11 PM
Rank: Newbie
Groups: Member

Joined: 8/20/2011
Posts: 4
hello

Thanks for rply.
I did what you told but it still not working.
It never enter into that script Switch loop.

Thanks and Regards


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.