将鼠标悬停在嵌套网格视图上

本文关键字:网格 视图 嵌套 鼠标 悬停 | 更新日期: 2023-09-27 18:33:31

我有一个网格视图。在里面我有一个嵌套的网格视图。我正在使用javascript进行扩展折叠。我的问题是,当我尝试在嵌套网格视图上添加 ajax 悬停菜单扩展器时,悬停不显示。我的代码:

<script type="text/javascript">
    $("[src*=plus]").live("click", function () {
        $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
        $(this).attr("src", "../minusbutton.png");
    });
    $("[src*=minus]").live("click", function () {
        $(this).attr("src", "../plusbutton.png");
        $(this).closest("tr").next().remove();
    });
</script>
<asp:GridView ID="GridViewCustomers" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False"  DataKeyNames="CustomerID">
    <Columns>
        <asp:TemplateField HeaderText="CustomerID" InsertVisible="False" 
                            SortExpression="lblCustomerID" Visible="False">
            <ItemTemplate>
                <asp:Label ID="lblCustomerID" runat="server" 
                            Text='<%# Bind("CustomerID") %>'>
                </asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Name"  
                            SortExpression="Name" >
            <ItemTemplate>
                <asp:Label ID="Name" runat="server" Text='<%# Bind("Name") %>'>
                </asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <img alt = "" style="cursor: pointer" src="../plusbutton.png" />
                <asp:Panel ID="pnlCustomersDetails" runat="server" Style="display: none">
                    <asp:GridView ID="mynestedGridView"  runat="server" 
                                AutoGenerateColumns="False"
                                DataKeyNames="DetailsID">
                        <Columns>
                            <asp:TemplateField Visible="false" HeaderText="DetailsID">
                                <ItemTemplate>
                                    <asp:Label ID="lblDetailsID"   runat="server" Text='<%# Bind("DetailsID") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Details>
                                <ItemTemplate>
                                    <asp:Label ID="lblDetails"  runat="server" Text='<%# Bind("Details") %>'></asp:Label>
                                    <br />
                                    <asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="lblDetails" PopupControlID="Panel2" PopupPosition="Center" OffsetX="0" OffsetY="0" PopDelay="50">
                                    </asp:HoverMenuExtender>
                                    <asp:Panel ID="Panel2" runat="server">
                                        <asp:Button ID="Button1"  runat="server" Text="Button"></asp:Button>
                                    </asp:Panel>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </asp:Panel>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

将鼠标悬停在嵌套网格视图上

背后的代码是什么样的?

我发现本教程在处理嵌套网格视图元素时非常有用:

http://www.aspsnippets.com/Articles/ASPNet-Nested-GridViews-GridView-inside-GridView-with-Expand-and-Collapse-feature.aspx