将Eval交给收货人控制 [英] passing Eval to reapeater control

查看:77
本文介绍了将Eval交给收货人控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个中继器控件.我正在尝试将Eval设置为图像源,但是我的代码无法正常工作.在这里

Hi,

I have a repeater control. I am trying to set Eval as image source but my code is not working. here it is

<img src='<%#"uploads/team/" + Eval("Image")%>' />


其中uploads/team/是图像位置,而Eval("Image")包含图像名称.

任何建议代码有什么问题吗?


Where uploads/team/ is the image location and Eval("Image") contains the image name.

Any suggestions what is the issue with the code?

推荐答案

知道了.您错过了Eval方法上的字符串转换.纠正的代码是:

Got it. You missed the string conversion on the Eval method. Rectified code is:

<img src="<%#"uploads/team/" + Eval("Image").ToString()%>" />


经过验证的代码
Rectified Code
<img src='<%#"uploads/team/" + Eval("Image").ToString()%>' />


或这个


or this

<img src='<%# Eval("Image","uploads/team/{0}") %>'>

</img>


这篇关于将Eval交给收货人控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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