[英]How to remove duplicates options from the datalist in HTML using javascript or jquery?
[英]show full image using javascript or jquery from datalist
我正在使用 uplodify upload 来上传图像并将其绑定到数据列表中,我可以上传和查找图像,但现在我想在大预览中显示图像。
场景是
默认情况下,第一个图像应该以大尺寸显示,之后当用户单击下一行时,下一行图像应该以大尺寸显示,直到用户不单击其他行。
如何在 javascript 或 jquery 的帮助下做到这一点。
请尽快帮助我...
我的数据列表是
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Vertical" onitemcommand="DataList1_ItemCommand" onitemdatabound="DataList1_ItemDataBound" CaptionAlign="Right" CellSpacing="6">
<ItemTemplate>
<asp:ImageButton ID="Image" runat="server" ImageUrl='<%#"~/Controls/ShowImage.ashx?FileName=" +DataBinder.Eval(Container.DataItem, "FilePath") %>'
OnCommand="Insert_Command" CommandArgument='<%# Eval("Id").ToString() +";"+Eval("FilePath")%>' />
<asp:Label ID="lblimagenumber" runat ="server" Text='<%# DataBinder.Eval(Container.DataItem, "FileName") %>' ></asp:Label>
</ItemTemplate>
</asp:DataList>
您可以在包含所有上传图像的数据列表下方或顶部有一个容器。 使用类似这样的js
标记
<div id="imagePreview"></div>
JS
$("dataListSelector").find("img").click(function(){
$("#imagePeview").html("<img src='"this.src"' />");
});
Css - 以大尺寸显示图像预览
#imagePeview img
{
height:400px;//You can either set height or width to an image, it will scale accordingly
}
我拿了一个div
<div id="loadarea" class="imageViewArea">
<asp:Image ID="imgthumb" runat="server" />
</div>
在插入命令上
Image imgThumb = (Image)this.FindControl("imgthumb");
imgThumb.ImageUrl = "~/Controls/ShowImage.ashx?FileName=" + ImgName;
我能够显示图像
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.