Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to show a tooltip for asp.net gridview cell?

Example,

Name
Student1
Student3
Student4

if mouse hover Student1 then i want to display tooltip as a Student1
Posted
Updated 8-Oct-13 19:47pm
v4

C#

XML
Following is the code for use in the Frontend /markup.



<asp:TemplateField HeaderText="Description"
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Left(Eval("Description"),20) %>'
tooltip='<%# Eval("Description") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>



This can be done using Codebehind from the RowDataBound event of the GridView
 
Share this answer
 
v2
you can do it using template column as shown below :

XML
<asp:GridView runat="server" ID="gridMain" AutoGenerateColumns="False">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <div title='<%#Eval("StudentName") %>'>
                        <%#Eval("StudentName") %>
                    </div>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
 
Share this answer
 
Comments
amnk.info 9-Oct-13 2:00am    
Thanks It works (Y)
You can check the below CP link

How to show tooltip text in gridview row on mouseover?[^]

Hope this helps..
 
Share this answer
 
Hi,
We Can use JQUery TOOLTip for better responsive view no additional plugin is necessary. Piece of css and JQuery -> Tool Tip For Gridview with CSS
 
Share this answer
 
v2
Comments
Deepu S Nair 27-May-15 9:41am    
Did you notice that this question is nearly 2 years old and already solved ?
XML
<asp:GridView runat="server" ID="gridMain" AutoGenerateColumns="False">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton ID="linkbtn" runat="server"
                        Text=' <%#EvalStudentName%>'   ToolTip="View Student Profile"></asp:LinkButton>
                    </div>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
 
Share this answer
 
v3
See this: Tooltip in gridview cell in asp.net[^]

Regards..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900