如何将图像绑定到表单视图中的标签
首先,我有一个 getProfileImage.aspx,它接受 CusID 和 TN 作为查询字符串并显示 n 图像。所以 getProfileImage.aspx?CusID=10&TN=Y 将在浏览器中很好地显示图像:)
但是...
现在我看到一个表单视图,我想绑定图像的 src 以从getProfileImage.aspx 页面...
以下代码工作正常:) 10 是客户 ID,图像工作正常...
<asp:Image ID="Image1" runat="server" Height="151px" ImageUrl='~/getProfileImage.aspx?CusID=10&TN=N' />
但现在我想绑定 CusID 值...
<asp:Image ID="Image1" runat="server" Height="151px" ImageUrl='~/getProfileImage.aspx?CusID=<%# Bind("CusID") %>&TN=N' />
这根本不起作用:( getProfileImage.aspx 页面... aspx 是用 CusID=<%... 调用的,我认为 <%# Bind("CusID") %> 不会被 ASP 解析,它会返回 10...
<%# Bind("CusID") %>
仅上面的标签就会工作...但将其插入标签中间似乎会破坏它...
提前有什么建议吗?
First i have a getProfileImage.aspx which accepts a CusID and TN as query strings and display n image. So getProfileImage.aspx?CusID=10&TN=Y will show the image fine in the browser :)
But...
Now i am presented with a Form View and i want to bind the src of the image to get the image from the getProfileImage.aspx page...
The following code works fine :) 10 is the customer ID and the image is working fine...
<asp:Image ID="Image1" runat="server" Height="151px" ImageUrl='~/getProfileImage.aspx?CusID=10&TN=N' />
But now i want to Bind the CusID value...
<asp:Image ID="Image1" runat="server" Height="151px" ImageUrl='~/getProfileImage.aspx?CusID=<%# Bind("CusID") %>&TN=N' />
This simply does not work :( The getProfileImage.aspx is called with CusID=<%... where the way i see it the <%# Bind("CusID") %> is not parsed by ASP which would have returned 10...
<%# Bind("CusID") %>
The above tag alone will work... but inserting it to the middle of the tag seems to break it...
Any suggestions ? Thanx a lot in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
耶耶! :) 我找到了答案 :)
{0} 被 CusID 替换,这正是我想要的 :)
也非常感谢 Robin Day 的帮助:) :)
Yeyy! :) I found the answer :)
The {0} is replaced by the CusID which is just what i wanted :)
Thanx a lot Robin Day for your help too :) :)