GRIDVIEW TOOLTIP acting strange with lots of characters.

Posted on 2007-07-30
Last Modified: 2013-11-26
I have a web application... I query a db, load the data into a gridview.

One of the fields has a lot of text in it.    When displayed, it stretches out the grid and it looks bad.  
I wrote code to fix this.  If there are more than 33 characters, I replace the text with "Move mouse cursor over to see finding..."  I load the text into tooltip...    The tooltip under that gridview... IE GridView1.Rows(i).Cells(8).ToolTip = GridView1.Rows(i).Cells(8).Text

This works excellent except for when there is a whole lot of text.    Sometimes the text reach over 2000 characters.  When this happens and you drag the mouse over the field "Findings" and it popups up the tooltip but the tooltip starts opening and closing in 1/2 sec intervals.  It is annoying....

This there anything I can do to fix this???   I started looking at ways to customize the tooltip, but it all had to do with actually tooltip class...    I wasn't sure how to customize the gridview tooltip.    

I know tooltip probably wasn't designed to handle a ton of characters, but hopefully there is an easy fix for this.

If not, does anyone have any ideas on others ways to approach this?

Question by:strongd
    LVL 22

    Expert Comment

    Do you really have to display the ENTIRE string? Can't you just display let's say, the first 1000 characters or so?

    Author Comment

    I could, but the problem is that field is very important.  

    This table I am querying off is dealing with environmental inspections.  When an organization does very poorly, the finding could be big.  The inspectors sometimes might need to really get down to the detail of their finding so the organizations managers know how to fix the problem before the next inspection.

     How hard is it to popup a small browser window (One with no back or forward buttons, for anything else...).  I am not sure what they are called, but I notice on some sites, you might need info on something and if you click it, some sites will popup a small browser type window with info in it.  I was thinking about trying that, but I don't know what the window is called or how to do it.  

    LVL 22

    Expert Comment

    It's not really difficult to open a popup window when you click something. Example with a button:

    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="'')" />

    Instead of Google, you can put any other page there (for example, a custom page to which you pass the ID and it displays the text)

    Author Comment

    How do I customize the window????  I don't want it to be a regular browser with all the button or dropdown menu's...

    Just a basic small browser...    Is that possible???  
    LVL 12

    Accepted Solution

    this will create an IE instance with no toolbars and such.

    Dim ie
    Set ie=createobject("internetexplorer.application")
    With ie
        .navigate "about:blank"
        Do Until .readyState=4
         WScript.Sleep 10
        .navigate "http://cachetweb"
    End With

    but i'm curious if any of this is necessary if you say you're only doing this because it stretches out your gridview. can't you just wrap it by setting the width of the column explicitly? <asp:BoundField .... Width="200" />
    LVL 12

    Expert Comment

    oh and you'll have to turn on the wrapping on that column, too.

    Author Comment

        How does the wrap work??? I mean, will it show like the first 10 characters??? IE   "Hazard waste was...."  

    Then if I click will expand????

    I am going to give you the points since you posted on how to control a popup.  

    Thanks for your help... also, DarkoLord... I want to thank you to.

    LVL 12

    Expert Comment

    wrapping just sends the text that goes beyond your fixed width to the next line so instead of:

    this is an incredibly long string to put in a gridview cell

    you'd get:

    this is an incredibly
    long string to put
    in a gridview cell.

    Author Comment

    Actually, I have done that wouldn't work, it will make the grid to tall and won't look right.

    I think the popup browser is the answer.  

    THanks for your help.


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    733 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

    24 Experts available now in Live!

    Get 1:1 Help Now