Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将图像绑定到<;asp:Image/>;表单视图中的标记_C#_Asp.net_Image_Bind_Formview - Fatal编程技术网

C# 如何将图像绑定到<;asp:Image/>;表单视图中的标记

C# 如何将图像绑定到<;asp:Image/>;表单视图中的标记,c#,asp.net,image,bind,formview,C#,Asp.net,Image,Bind,Formview,首先,我有一个getProfileImage.aspx,它接受CusID和TN作为查询字符串并显示n image。因此getProfileImage.aspx?CusID=10&TN=Y将在浏览器中显示图像:) 但是 现在我看到了一个表单视图,我想绑定图像的src以从getProfileImage.aspx页面获取图像 以下代码工作正常:)10是客户ID,图像工作正常 <asp:Image ID="Image1" runat="server" Height="151px" ImageUrl

首先,我有一个getProfileImage.aspx,它接受CusID和TN作为查询字符串并显示n image。因此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时使用CusID=Yeyy!:)我找到了答案:)

ImageUrl=''
{0}被CusID替换,这正是我想要的:) 谢谢你的帮助:):)

<%# Bind("CusID") %>
ImageUrl='<%# Eval("CusID", "getProfileImage.aspx?CusID={0}&TN=N") %>'