我有一个带有工具提示的ImageButton。单击该按钮时,工具提示保持可见并粘在页面上的鼠标上。我希望单击按钮后工具提示消失,但无法找到执行此操作的方法。
任何建议将不胜感激! 标记:
<asp:TemplateField HeaderText="Mark as Read">
<ItemTemplate>
<asp:ImageButton ID="img_markAsRead" runat="server" ImageUrl="img/icons/eye.png" CssClass="tooltip" Width="20" ToolTip="Mark this Notification as Read" CommandName="Edit" CommandArgument='<%# Eval("notification_id")%>'/>
</ItemTemplate>
</asp:TemplateField>
CSS:
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
}
代码背后:
protected void grdv_RowEditing(object sender, GridViewEditEventArgs e)
{
GridViewRow theRow = grdv_notifications.Rows[e.NewEditIndex];
ImageButton theButton = (ImageButton)theRow.FindControl("img_markAsRead");
string notificationNo = theButton.CommandArgument;
#region the clever sql statement to do the updates
#endregion
//reload the gridview
loadGridview();
//set the notification number
MasterPage master = (MasterPage)this.Master;
master.updateNotificationCount(grdv_notifications.Rows.Count);
}
答案 0 :(得分:0)
基于你的 jQuery 标签以及类名是“ui-tooltip”的事实,我猜你正在使用jQuery UI工具提示。在这种情况下,其中一个选项是“track”,初始化时可以将其设置为 false ...
$( document ).tooltip({
track: false
});
默认情况下应为 false ,因此您必须将其设置为 true 。
答案 1 :(得分:0)
在绞尽脑汁后,答案很简单。
添加Response.Redirect("notifications.aspx");
在点击ImageButton重新加载页面后重新加载页面并清除工具提示。 简单但有效!