HoverMenuExtender无法正常工作

时间:2011-04-19 09:57:23

标签: asp.net ajax

这是我的代码,我按照教程但无法弄清楚为什么它不起作用

        <form id="form1" runat = "server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
            <asp:HoverMenuExtender ID="HoverMenuExtender1" 
                        runat="server"
                        TargetControlID = "OR"
                        PopupControlID = "PanelOR"
                        PopupPosition = "bottom"
                        OffsetX = "6"
                        PopDelay = "50"
                        HoverCssClass = "popupHover">
            </asp:HoverMenuExtender>

            <asp:Panel ID="PanelOR" 
                        runat="server" 
                        Height = "50px"
                        Width="200px" 
                        CssClass="popupMenu">
                   <asp:LinkButton ID="Attribution" runat="server" CommandName="One" Text="Attribution"></asp:LinkButton><br />
                   <asp:LinkButton ID="Gestion" runat="server" Text="Gestion des OR"></asp:LinkButton>
            </asp:Panel>              
               <asp:LinkButton ID="OR" runat="server">should happen here</asp:LinkButton>
            </div>
            </form>

在css文件

.popupMenu 
{
    visibility:hidden;
}

.popupHover 
{
    background-color:White;
}

提前致谢

2 个答案:

答案 0 :(得分:0)

您必须将面板显示为无悬停

.popupMenu 
{
display:none;
}

更新: 我不知道为什么它不起作用,但这里是我写的快速代码,它只是开箱即用。

<body>
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <div>
        <asp:Panel ID="Panel1" runat="server" CssClass="pnl">
            <input type="button" value="button1" id="btn1" />
            <input type="button" value="button2" id="btn2" />
        </asp:Panel>
        <asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server" BehaviorID="hmeBehaviour"
            PopupPosition="Bottom" TargetControlID="LinkButton1" PopupControlID="Panel1">
        </asp:HoverMenuExtender>
        <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
    </div>
    </form>
</body>

.pnl
{
    width:100px;
    height:100px;
    background-color:#CFCFCF;
    border:1px solid #CECECE;
    color:#CF0000;
}

当我将鼠标悬停在链接按钮上时,我会看到链接按钮下方的两个按钮。

答案 1 :(得分:0)

显然我不能将工具包用于MVC 2