在ASP.NET中将Eval与ImageURL绑定 [英] Binding Eval with an ImageURL in ASP.NET

查看:105
本文介绍了在ASP.NET中将Eval与ImageURL绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Eval()与VB.NET和ASP.NET绑定图像,但是遇到问题:

I'm trying to bind an image using Eval() with VB.NET and ASP.NET, but am running into issues:

<bri:ThumbViewer Id="Th1"  runat="server" 
   ImageUrl='<%# Eval("Name", "~/SiteImages/ram/3/{0}") %>' 
   Height="100px" 
   Width="100px" 
 />

我在后面的代码中设置了 strImagePath 如:

I set strImagePath in the code-behind as:

strImagePath  ="~/SiteImages/ram/3/"

我该如何替换:

~/SiteImages/ram/3/{0} 

具有变量 strImagePath

推荐答案

简单使用

<asp:Image id="abc" ImageUrl =<%# string.Format("~/SiteImages/ram/3/{0}",Eval("imagepath"))%>

图像路径可能来自数据表或CS

imagepath could be from datatable or cs

这篇关于在ASP.NET中将Eval与ImageURL绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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