7

I need to show a tooltip when mouse is placed on GridView Row (onmouseover) I need to set the Tooltip content Dynamically in GridView_RowData

How can I Do this??

Can I Do this in e.Row.Attributes.Add(... ??

4
  • @krshekhar Can you please explain how ?? Commented Oct 31, 2012 at 9:05
  • hope this url help you stackoverflow.com/questions/3871934/tooltip-in-gridview Commented Oct 31, 2012 at 9:06
  • 2
    e.Row.Attributes.Add("title", "title value"); Commented Oct 31, 2012 at 9:07
  • or from aspx as suggested by @saeedmirzaiesaran Commented Oct 31, 2012 at 9:08

3 Answers 3

15

Try it like this...

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");
    }
 }

This will show tooltip for entire row..If you need to show on a particular control then find that control and set is Tooltip attribute to your own title...

Sign up to request clarification or add additional context in comments.

Comments

0

Can be Done like this. Here is the working copy.

What you need to do is, you have to find the control(for which you want to display tooltip on hover of mouse) inside the Gridview OnRowDataBound event and assign the tooltip text to the control.

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;
    }
}

Comments

0

try this

    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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.