网页中:
<ItemTemplate>
<a href='' target="_blank" runat="server" id="vLnkImage">
<asp:Image id="vImage" runat="server"></asp:Image>
</a>
</ItemTemplate>
代码中:
if(e.Item.ItemIndex > -1)
{
DataRowView drv = (DataRowView)e.Item.DataItem;
System.Web.UI.WebControls.Image Img = (System.Web.UI.WebControls.Image)e.Item.FindControl("vImage");
Img.ImageUrl = "/Images/+drv["c_FileName"].ToString();
HtmlAnchor Link1 = (HtmlAnchor)e.Item.FindControl("vLnkImage");
Link1.HRef = "http://"+drv["c_URL"].ToString();
}