1

我有一个网格视图,其中一个单元格将显示另一个网格视图作为工具提示,其中包含从数据库加载的数据,但每次加载主网格视图时都会显示工具提示网格视图。我希望仅当用户将鼠标悬停在单元格上时才显示工具提示 gridview。

知道如何使工具提示 gridview 仅在用户将鼠标悬停在单元格标签上时才显示?

<asp:GridView ID="gvINCpym" runat="server" AllowSorting="True" AutoGenerateColumns="False"
              CaptionAlign="Left" CssClass="GridViewStyle" EmptyDataText="No Record Found"
              GridLines="None" ShowFooter="True" Width="960px"
              AllowPaging="True">
  <RowStyle CssClass="RowStyle" />
  <EmptyDataRowStyle CssClass="EmptyRowStyle" />
  <Columns>
      <asp:TemplateField HeaderText="QB (30%)">
          <ItemTemplate>
                <asp:Label ID="lblQB" runat="server" Text="<%# Bind('QB') %>"></asp:Label>
                <cc1:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="lblQB"
                     PopupControlID="pnlQBDet" PopupPosition="Right" OffsetX="0" OffsetY="0" 
                     PopDelay="25">
                </cc1:HoverMenuExtender>
                <asp:Panel ID="pnlQBDet" runat="server">
                    <asp:GridView ID="gvQBDet" runat="server">
                    </asp:GridView>
                </asp:Panel>
        </ItemTemplate>
        <HeaderStyle CssClass="HeaderStyle" Width="80px" />
        <ItemStyle HorizontalAlign="Right" Width="80px" />
      </asp:TemplateField>
    </Columns>
</asp:GridView>

Private Sub gvINCpym_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvINCpym.RowDataBound
Try
    If (e.Row.RowType = DataControlRowType.DataRow) Then
        Dim secondGrid As GridView = CType(e.Row.FindControl("gvQBDet"), GridView)

        MsFg2.gvSql =
            "SELECT SUBSTRING(CONVERT(VARCHAR(11), DATE1, 113), 4, 8) AS CalcMnth, AMT2 AS QB, AMT3 AS KB " & _
            "FROM dbo.Inc_Bonus_Tran NOLOCK " & _
            "WHERE (DATE2 BETWEEN '" & CVRMgr.getDateSQL(txtDtFrm.Text) & "' AND '" & CVRMgr.getDateSQL(txtDtTo.Text) & "') " & _
            "AND TYPE = 'INC' AND SUBTYPE = 'T2' " & _
            "AND STAFFID = '" & rowView("StfID") & "'"


        MsFg2.CreateDataTable(DB, MsFg2.gvSql, cnnVLD, True, True)
        Session(MsFg2Ses) = MsFg2.gvDataTable.DefaultView.ToTable

        secondGrid.DataSource = Session(MsFg2Ses)
        secondGrid.DataBind()
    End If
Catch ex As Exception
    cMessageManagerAlertOnly.ErrorMsgAlert(ex.Message, Me.Page)
End Try
End Sub
4

1 回答 1

1

设法找出解决方案。需要使用 CSS 隐藏面板“pnlQBDet”,以便工具提示网格视图不会显示在页面加载/回发中。

<style type="text/css">
.PopupMenu
{
    display: none;
}
</style>
于 2013-03-31T08:46:29.690 回答