在asp.net图像控件上单击jquery或javascript图像弹出窗口 [英] jquery or javascript image popup on asp.net image control click

查看:56
本文介绍了在asp.net图像控件上单击jquery或javascript图像弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net图像控件,其中我从后面的代码绑定图像。我想当我点击这个图像控件时它会弹出这个图像。

 <  < span class =code-leadattribute> asp:Image     ID   =  Image1   高度  =  100   宽度  =  100 < span class =code-attribute>   style   =  cursor:pointer    runat   =  server    /  >  



 Image1.ImageUrl =  〜/ Image / + Convert.ToString(读者[   imagepath1]); 

解决方案

嗨Raj,



如果我们在点击图像时绑定图像,则不必要地进行回发,因此最好绑定第一次去的网址只保留隐藏模式。



其实不需要asp:图像控制简单的img标签也可以解决这个问题。 />


以下代码将在点击按钮时弹出一个图像。请根据您的要求更改此选项。



 <   html     xmlns   =  http://www.w3.org/1999/xhtml >  
< head runat = server >
< title < span class =code-keyword>> < / title >
< scr ipt type = text / javascript src = jquery-1.8.2.min.js > < / script < span class =code-keyword>>
< script type = text / javascript src = jquery-ui-1.8.24.min.js > < span class =code-keyword>< / script >
< script 类型 = text / javascript >


document )。ready( function (){


#MyImage)。dialog({
autoOpen: false
}) ;

I have one asp.net image control in which i bind image from code behind. I want when i click on this image control it shows this image as pop up.

<asp:Image ID="Image1" Height="100" Width="100" style="cursor: pointer" runat="server" />


Image1.ImageUrl = "~/Image/" + Convert.ToString(reader["imagepath1"]);

解决方案

Hi Raj,

If we bind the imageurl on click of the image it unnecessarily goes for a postback, so it is better to bind the url at the first go only and keep in hidden mode.

Actually no need of having the asp:Image control simple img tag can also solve this problem.

The below code will show an image in popup on click of the button. Please change this ti suit your requirement.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="jquery-ui-1.8.24.min.js"></script>
    <script type="text/javascript">


(document).ready(function () {


("#MyImage").dialog({ autoOpen: false });


这篇关于在asp.net图像控件上单击jquery或javascript图像弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆