繁体   English   中英

如何在GridView Row Hover上显示工具提示

[英]How to display Tooltip on GridView Row Hover

当鼠标放在GridView Row上时我需要显示工具提示(onmouseover)我需要在GridView_RowData动态设置工具提示内容

我怎样才能做到这一点??

我可以在e.Row.Attributes.Add(... ??

试试这样......

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        //use this way
        e.Row.ToolTip = "My FooBar tooltip";
         //or use this way
        e.Row.Attributes.Add("title", "My FooBar tooltip");
    }
 }

这将显示整行的工具提示。如果需要在特定控件上显示,则找到该控件并将Tooltip属性设置为您自己的标题...

可以这样完成。 这是工作副本。

您需要做的是,您必须在Gridview OnRowDataBound事件中找到控件(您希望tooltip on hover of mouse显示tooltip on hover of mouse )并将tooltip文本分配给控件。

protected void GridDepartment_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        Label LabelCoachName = e.Row.FindControl("LabelCoachName") as Label;
        LabelCoachName.ToolTip = LabelCoachName.Text;
    }
}

试试这个

    If e.Row.RowType = DataControlRowType.DataRow Then
        'your dynamic data fill to e.row.tooltip
        e.Row.ToolTip = e.Row.Cells(1).Text & "-" & e.Row.Cells(3).Text
    End If

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM