如何在gridview中检索图像缩略图 [英] How do I retrieve an image thumbnail in gridview
问题描述
我正在尝试在gridview中实现图像缩略图的功能,我可以使用以下示例在新的浏览器窗口中查看它的完整大小:
http://odetocode.com/articles /172.aspx
在本文的最后部分,有一条指令可以在查询字符串中传递一个附加参数,以便您查看图像的完整大小当它在新的浏览器窗口中打开时。我该如何实现此功能?我理解附加参数应该参考文章中概述的下面的源。
I am trying to implement functionality for an image thumbnail within a gridview whereby I can view it full size in a new browser window using the example at :
http://odetocode.com/articles/172.aspx
In the last part of the article there is an instruction to pass an additional parameter in the query string so that you view the full size of the image when it opens in new browser window. How do I implement this functionality? I understand that the additional parameter should refer to source below as outlined in the article.
<ItemTemplate >
<a href='<%# "getImage.aspx?ThumbNail=\"N\"&ID=" + DataBinder.Eval(Container.DataItem,
"ImageIdentity") %>'>
<img runat="server" src='<%# "getImage.aspx?ID=" + DataBinder.Eval
(Container.DataItem, "ImageIdentity")%>' ID="Img1"/>
</a>
</ItemTemplate>
我想知道我是怎么回事可以将附加参数传递给getImage.aspx页面下面的代码片段
I want to know how i can pass the additional parameter to the snippet below in the getImage.aspx page
System.Data.SqlClient.SqlDataReader Reader=null;
string ImageIdentity = Request.QueryString["ID"].ToString();
SqlConnection sqlConnection = new SqlConnection(@"initial catalog=Articles;user
id=sa;password=;server=myServer");
sqlConnection.Open();
SqlCommand sqlCommand = new SqlCommand("Select Images,ImageType from Images where
imageKey="+ImageIdentity ,sqlConnection);
Reader= sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
Reader.Read();
我尝试过:
我尝试过这个订单:
What I have tried:
I have tried something of this order:
con = New SqlConnection(ConfigurationManager.ConnectionStrings("Constring").ConnectionString)
If Not IsPostBack Then
Dim docID = Request.QueryString("id")
Dim docIDapp = Request.QueryString("idapp")
If Request.QueryString("id") <> "" Then
cmd = New SqlCommand("Select * from ONLINELOANS where id = '" & docID & "'", con)
'ElseIf Request.QueryString("entity") <> "" Then
' cmd = New SqlCommand("Select * from PROCURING_DOCUMENTS where id = '" & docID & "'", con)
'Else
' cmd = New SqlCommand("Select * from CAPITAL_DOCUMENTS where id = '" & docID & "'", con)
End If
If Request.QueryString("idapp") <> "" Then
cmd = New SqlCommand("Select * from ONLINELOANS where id = '" & docID & "'", con)
推荐答案
以下网址引用将为您提供帮助。
在C#,VB.NET - ASP.NET,C#中从数据库中显示Asp.net Gridview中的图像.NET,VB.NET,JQuery,JavaScript,Gridview [ ^ ]
The below Url reference will help you.
Display Images in Asp.net Gridview from Database in C#, VB.NET - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview[^]
这篇关于如何在gridview中检索图像缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!