Home All Groups Group Topic Archive Search About

Menu control MenuItemClick does not fire.

Author
10 Mar 2006 9:08 PM
nickpup
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="MainMenu.ascx.vb"
Inherits="UC_MainMenu"  %>
<!--            OnMenuItemClick="Menu1_MenuItemClick"> -->

<table width="100%" border="0" cellpadding="0" cellspacing="0"
class="StaticMenuStyle">
<tr>
  <td valign="top">
       <asp:Menu ID="Menu1"  runat="server" Orientation="Horizontal" 
            DynamicVerticalOffset="0" DynamicHorizontalOffset="0" 
            StaticEnableDefaultPopOutImage="false"
            StaticItemFormatString="{0}" ItemWrap="true">
            <StaticMenuItemStyle  CssClass="StaticMenuItemStyle" />
            <StaticHoverStyle CssClass="StaticMenuHoverStyle"  />

           <DynamicMenuStyle CssClass="DynamicMenuStyle" />
           <DynamicMenuItemStyle CssClass="DynamicMenuItemStyle"  />
           <DynamicHoverStyle CssClass="DynamicHoverStyle" />

        </asp:Menu>
    </td>
  <td width="100%" valign="top">

<div class="StaticMenuItemStyle"></div>
  </td>
</tr>
</table>


And here is the VB routine:
Public Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As
MenuEventArgs) Handles Menu1.MenuItemClick
        Dim message As String
        ' Display the text of the menu item selected by the user.
        message = "You selected " & e.Item.Text & "."

End Sub

I Don’t see an AutoPostBack property for the menu control.
I have tried delcaring the routine as private and public, adding and
removing the Handles clause and adding and removing the OnMenuClick clause in
the ASPX.  None of it seems to make any difference.  The routine never seems
to run.  Can anyone help?
Thanks,
nickpup

Author
11 Mar 2006 11:35 AM
Phillip Williams
Add MenuItems that do not set a value for the NavigateUrl property.
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.menuitemclick(VS.80).aspx
Show quoteHide quote
"nickpup" wrote:

> <%@ Control Language="VB" AutoEventWireup="false" CodeFile="MainMenu.ascx.vb"
> Inherits="UC_MainMenu"  %>
> <!--            OnMenuItemClick="Menu1_MenuItemClick"> -->
>
> <table width="100%" border="0" cellpadding="0" cellspacing="0"
> class="StaticMenuStyle">
>  <tr>
>   <td valign="top">
>        <asp:Menu ID="Menu1"  runat="server" Orientation="Horizontal" 
>             DynamicVerticalOffset="0" DynamicHorizontalOffset="0" 
>             StaticEnableDefaultPopOutImage="false"
>             StaticItemFormatString="{0}" ItemWrap="true">
>             <StaticMenuItemStyle  CssClass="StaticMenuItemStyle" />
>             <StaticHoverStyle CssClass="StaticMenuHoverStyle"  />
>
>            <DynamicMenuStyle CssClass="DynamicMenuStyle" />
>            <DynamicMenuItemStyle CssClass="DynamicMenuItemStyle"  />
>            <DynamicHoverStyle CssClass="DynamicHoverStyle" />
>          
>         </asp:Menu>
>     </td>
>   <td width="100%" valign="top">

>  <div class="StaticMenuItemStyle"></div>
>   </td>
>  </tr>
> </table>
>  
>        
> And here is the VB routine:
> Public Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As
> MenuEventArgs) Handles Menu1.MenuItemClick
>         Dim message As String
>         ' Display the text of the menu item selected by the user.
>         message = "You selected " & e.Item.Text & "."
>
> End Sub
>
> I Don’t see an AutoPostBack property for the menu control.
> I have tried delcaring the routine as private and public, adding and
> removing the Handles clause and adding and removing the OnMenuClick clause in
> the ASPX.  None of it seems to make any difference.  The routine never seems
> to run.  Can anyone help?
> Thanks,
> nickpup
>
>