• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 879
  • Last Modified:

GRIDVIEW TOOLTIP acting strange with lots of characters.

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?

  • 4
  • 3
  • 2
1 Solution
Do you really have to display the ENTIRE string? Can't you just display let's say, the first 1000 characters or so?
strongdAuthor Commented:
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.  

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="window.open('http://www.google.com')" />

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)
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

strongdAuthor Commented:
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???  
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" />
oh and you'll have to turn on the wrapping on that column, too.
strongdAuthor Commented:
    How does the wrap work??? I mean, will it show like the first 10 characters??? IE   "Hazard waste was...."  

Then if I click that...it 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.

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.
strongdAuthor Commented:
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now