?
Solved

Tooltip containing an image on a image column of a gridview

Posted on 2011-10-28
8
Medium Priority
?
603 Views
Last Modified: 2012-06-27
Hi,

I am new with .net and I have a question about tooltips. I have a gridview containing products of a catalogue in an asp.net 2008 page. I have one image column (second column so index=1) in it that contains a camera picture when a picture of the product is available. On mouse over this column I wanna pop a tooltip that shows the actual image of the product.

In the rowdatabound event of my gridview, I have the following that shows the camera picture  :

        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim pathphoto As String
            pathphoto = "./picturesproducts/" & e.Row.Cells(0).Text & ".jpg"
            If System.IO.File.Exists("c:\temp\picturesproducts\" & e.Row.Cells(0).Text & ".jpg") Then
' one picture of the product is available show the camera
                e.Row.Cells(1).Text = "<img src='./img/tub_pic.jpg'/>"
                e.Row.Cells(1).ToolTip = I want to put an image of the product into that tooltip          

            End If
           
        End If

Thank you all
0
Comment
Question by:julcar
  • 4
  • 4
8 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 37046116
0
 

Author Comment

by:julcar
ID: 37046407
Thank you for your answer. I've checked the page but this is not exactly what I look for because in this example the background image in the tooltip is always the same (only the text of the tooltip change), I need to be able to put a different image in the tooltip of each row.

Any idea?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37046630
That's just an example. You can put an asp:Image control in there. Or change this

<div style="background: url(bubble2.gif)

to

<div style="background: url('<%= Eval('fieldname') %>')
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:julcar
ID: 37046858
just tried to put
<div style="background: url('<%= Eval('fieldname') %>')  in  the template but asp.net doesn't seem to allow putting variables in templates...

Maybe it will be most simple if I make a window that opens onmouseover the colum and that shows the picture of the product in a new window in the center of the screen ??Does pop up blocker block these windows??  
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37047423
0
 

Author Comment

by:julcar
ID: 37056919
Finally, I just made the image open in a new window when clicking on the camera...

so in rowdatabound I have the line:  
 e.Row.Cells(1).Attributes.Add("onclick", "javascript:openimage('" + pathphoto + "');")

that call the javascript function:

function openimage(pathImage) {
  open(pathImage,null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
 
  }

0
 

Author Closing Comment

by:julcar
ID: 37056922
Thank you for your help CodeCruiser
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37057517
Glad to help :-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

864 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