Bind multiple values in a tooltip in Asp.net

Oct 30, 2015 By Mohammed Imtiyaz

Demo

Demo

Introduction

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.

Today I’m going to show you 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

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



Post your comment