如何在链接属性中使用图像按钮显示文件夹中的图像? [英] How to show image from folder with image button in link property?

查看:115
本文介绍了如何在链接属性中使用图像按钮显示文件夹中的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人告诉我如何使用带有超链接属性的图像按钮来显示图像,我很难通过超链接来显示图像,但是不能使用图像按钮来显示图像,

我的代码是:

Please some one tell me that how to show images with image button with hyperlink propery, I am bale to show image with hyper link, but not able with image button,

my code is:

<asp:Image Width="100" Height="100" ID="Image1" ImageUrl='<%# Bind("Name", "~/images/{0}") %>' runat="server" />
                 <asp:HyperLink ID="HyperLink1"  class="vlightbox1" Text='<%# Bind("Name") %>' NavigateUrl='<%# Bind("Name", "~/images/{0}") %>' runat="server"/>


我的代码显示的是带有超链接的图像名称的图像,例如feedback.jpg,但是我想要具有超链接属性的图像按钮,以便当我单击图像时,某些大图像路径会打开.

所以请有人帮助我.


My code is showing the images with name of image with hyperlink, like feedback.jpg , but I want image button with hyperlink property so that when i clicked on image some my big image path will open.

So please someone help me.

推荐答案

使用imagebutton并使用jquery.magnifier.js或
< asp:image id ="myimg" runat ="server" height ="50" width ="50" xmlns:asp =#unknown">


点击图片放大或点击下面的链接


< asp:超链接id ="linkimg" runat =服务器" target ="_ parent" xmlns:asp =#unknown">显示大图
=== .cs/根据myimagefolder文件夹中的id动态加载img
公共无效的ShowImage(string id)
{
图片i =(Image)FormView1.FindControl("myimg");
HyperLink l =(HyperLink)FormView1.FindControl("linkimg");
i.AlternateText ="ID图片:" + id;
i.ImageUrl = l.NavigateUrl = @"../myimagefolder/" + id +".jpg";
i.ToolTip = l.ToolTip =属性图片:" + id;
i.CssClass =放大";
}
use imagebutton and use jquery.magnifier.js or
<asp:image id="myimg" runat="server" height="50" width="50" xmlns:asp="#unknown">


Click on the image to Enlarge or Click Link Below


<asp:hyperlink id="linkimg" runat="server" target="_parent" xmlns:asp="#unknown">Show Large Image
=== .cs / dynamically load img based on id from the folder myimagefolder
public void ShowImage(string id)
{
Image i = (Image)FormView1.FindControl("myimg");
HyperLink l = (HyperLink)FormView1.FindControl("linkimg");
i.AlternateText = "Image for ID: " + id;
i.ImageUrl = l.NavigateUrl = @"../myimagefolder/" + id + ".jpg";
i.ToolTip = l.ToolTip = "Image for Property : " + id;
i.CssClass = "magnify";
}




您可以使用HTML控件来提出解决方案,请使用下面给出的代码,
Hi,

You can use HTML control to come up with solution, use the code given below,
<a href=''<%# Page.ResolveClientUrl(Bind("Name", "~/images/{0}")) %>'' class="vlightbox1"><img src=''<%# Page.ResolveClientUrl(Bind("Name", "~/images/{0}")) %>''/></a>



为了显示您在帖子中提到的大图像路径,您需要提供适当的属性来绑定宽度,即Bind("Name", "~/images/{0}")用大图像名称属性替换名称".

希望这会有所帮助.



in order to show big image path as you mention in your post, you need to provide proper property to bind width, i.e. Bind("Name", "~/images/{0}") replace "Name" with your big image name property.

Hope this will help.


这篇关于如何在链接属性中使用图像按钮显示文件夹中的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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