0

I have a list of vehicles, and each vehicle has its own image. Right now the thumbnail is displaying of the image is displaying, I would like to display the full size image when the thumbnail is clicked. It gets the image name from a database (c.VehicleImage). How can I create an onClick event for imgVehicleImage?

<tr>
    <td colspan="3">
        <asp:Image runat="server" ID="imgVehicleImage" />
    </td>
</tr>

Code behind:

if (!string.IsNullOrEmpty(c.VehicleImage))
{
    imgVehicleImage.Visible = true;
    imgVehicleImage.ImageUrl = "/thumbnail.ashx?ImgFilePath=" + ConfigurationManager.AppSettings["VehicleImageFolder"] + Company.Current.CompCode + "\\" + c.VehicleImage + @"&width=200&height=200"; ;
}
user123456789
  • 1,914
  • 7
  • 44
  • 100

1 Answers1

0

In the HTML use an asp:Image for both the thumbnail and image, but have the image hidden. Then when the thumbnail is clicked, hide the thumbnail and show the image.

You can use JQuery. See toggle visibility of div for an example.

Community
  • 1
  • 1
Richard Schneider
  • 34,944
  • 9
  • 57
  • 73