Line breaks inside a tooltip?

Posted on 2006-05-30
Last Modified: 2012-05-05
I have a web app in .Net 2.0 C#.  When it was in development on my local machine, I was able to display line breaks (using \n) in my tooltips.  Now, they're all one long line and show a fat pipe where the line break should be.

Anyone know a way I can get the tooltip to display correctly again?  I've looked at some javascript alternatives but haven't found anything I really like (and this isn't anything I want to spend lots of time on). :)


Question by:valkyrie_nc
    LVL 17

    Accepted Solution

    LVL 9

    Author Comment

    Thanks for the link, Lem2802.  I've tried the "title" attribute, but I still get those fat pipes in place of a "\n".  When I do a view source, there are no line breaks or \n's in there; instead, it looks in View Source like the line breaks are already there.  I tried escaping the \, but then I get something like this:  "Accounting\n\nJohn Doe\nJane Doe\n."  

    I tried the Dynamic Drive script before, and I guess that'll be my best bet.  Still can't figure out the "was working before but not now" deal. :)



    Expert Comment

    string newLine = Environment.NewLine;
    MyLable.ToolTip = string.Format("Accounting {0} John Doe", newLine);

    This will work.

    Reason for commenting closed item:
    Came across this solution when searching for similar issue and found an answer in msdn, it will help for those like me.

    msdn link


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now