Click here to Skip to main content
15,923,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every one, As i am using tooltip to show description,whenever user mouse over particular cell that using tool tip its shows description that contains many lines,as it shows all in single row i want it to break lines while showing in tooltip

protected void gvDetails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataControlRowType rtype = e.Row.RowType;
        if (rtype == DataControlRowType.DataRow && rtype != DataControlRowType.Footer
            && rtype != DataControlRowType.Separator && rtype != DataControlRowType.Header
       && rtype != DataControlRowType.Pager)
        {
            Label lbl = (Label)e.Row.FindControl("lblremark");
            Label lbl1=(Label)e.Row.FindControl("empname");
            e.Row.Cells[5].ToolTip = lbl.Text;
            e.Row.Cells[0].ToolTip = lbl1.Text;
        }


What I have tried:

Label lbl = (Label)e.Row.FindControl("lblremark");
           Label lbl1=(Label)e.Row.FindControl("empname");
           e.Row.Cells[5].ToolTip = lbl.Text;
           e.Row.Cells[0].ToolTip = lbl1.Text;


I am picking description from lblremark used in grid and employeedetails by empname in gridview can anyone help
Posted
Updated 7-Sep-17 2:22am

Yes - ToolTips obey "\r\n" characters and start on a new line.
So
C#
myObject.ToolTip = "Line 1\r\nLine 2\r\nLine 3";
will work fine.
 
Share this answer
 
In order to show line-breaks in controls you need to experiment a bit.
Even on the web, <br> doesn't work in an alert, you need to use \n.

So, do a test with various types of line breaks: \n \n\r and so forth.

Or - you could google it . . .
 
Share this answer
 
v2

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