2015-09-17 97 views
0

我有一個車輛列表,每輛車都有自己的圖像。現在縮略圖正在顯示圖像顯示,我想在點擊縮略圖時顯示全尺寸圖像。它從數據庫獲取圖像名稱(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"; ; 
} 
+0

綁定縮略圖的單擊事件並動態替換圖像源,或者可以添加兩個div。隨你便。 –

回答

0

在HTML中使用的asp:Image的縮略圖和圖像的雙方,但有圖像隱藏。然後,當點擊縮略圖時,隱藏縮略圖並顯示圖像。

您可以使用JQuery。一個例子見toggle visibility of div

相關問題