Bind multiple values in a tooltip in ASP.Net

Mohammed Imtiyaz Oct 30, 2015

Demo

Bind multiple values in a tooltip in ASP.Net

tooltips are a great way to show your user more information by simply hovering over an image or text. They can be used, for example, to provide captions for images, or longer descriptions for links, or any useful information which would improve the user experience of your site, without interfering the web page design.

In this tutorial you'll learn how to add multiple parameters in a tooltip in ASP.Net

Let us say we have asp:gridview control where we are binding the database table column (Ex: Employee Name), now let us assume that we want to display more information about the employee like email, branch, etc.. when we place the mouse over it.

It can be displayed by using “tooltip” tag for that control.

Let us see the code below

ASPX Page

<asp:GridView ID="gvEmployee" runat="server">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:CheckBox ID="cbEmployeeList" runat="server" Text='<%# Eval("emp_name") %>' tooltip='<%# "Name: " + Eval("emp_name") + "\n" + "Email: " + Eval("emp_email") + "\n" + "Branch: " + Eval("branch_name") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>