【问题标题】:How to display full sized image when thumbnail is clicked?单击缩略图时如何显示全尺寸图像?
【发布时间】:2015-12-14 01:51:56
【问题描述】:

我有一个车辆列表,每辆车都有自己的图像。现在正在显示图像的缩略图,我想在单击缩略图时显示全尺寸图像。它从数据库 (c.VehicleImage) 中获取图像名称。如何为 imgVehicleImage 创建 onClick 事件?

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

后面的代码:

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"; ;
}

【问题讨论】:

  • 你绑定一个缩略图的点击事件,动态替换图片源或者添加两个div。由你决定。

标签: c# asp.net image thumbnails


【解决方案1】:

在 HTML 中,缩略图和图像都使用asp:Image,但要隐藏图像。然后当点击缩略图时,隐藏缩略图并显示图像。

您可以使用 JQuery。示例见toggle visibility of div

【讨论】:

    猜你喜欢
    • 2010-10-02
    • 1970-01-01
    • 2017-04-23
    • 2014-09-10
    • 1970-01-01
    • 1970-01-01
    • 2014-03-19
    • 2019-07-07
    • 1970-01-01
    相关资源
    最近更新 更多