我有一个gridview,它根据另一列的值将图像加载到一列中。我希望图像可点击并以全宽显示图片加载图像的代码在这里
Protected Sub GridView2_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
Dim img As Image = e.Row.FindControl("imgID")
Dim NewSearch As String = ""
Dim mFile As String = ""
Dim MsPLIT As Array
NewSearch = e.Row.Cells(0).Text 'first column value
MsPLIT = Split(NewSearch, "+")
mFile = MsPLIT(0)
img.ImageUrl = mFile & ".jpg"
End If
End Sub
我试图插入超链接和图像,但我不知道如何将 URL 发送到图像文件。
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" NavigateUrl="?" runat="server">
<asp:Image ID="imgID" runat="server" Width="100" Height="100" />
</asp:HyperLink>
</ItemTemplate>