Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.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.NET服务器标记_C#_Asp.net - Fatal编程技术网

C# ASP.NET服务器标记

C# ASP.NET服务器标记,c#,asp.net,C#,Asp.net,当我使用: <asp:Label id="lbCatId" runat="server" Text='<%# Eval("VideoId") %>' Visible="true" /> <asp:Image runat="server" href='Play.aspx?VideoId=<%# Eval("VideoId") %>' ID="iThumbnailFileName" CssClass="content" /> 我得到: <

当我使用:

<asp:Label id="lbCatId" runat="server" Text='<%# Eval("VideoId") %>' Visible="true" />
<asp:Image runat="server" href='Play.aspx?VideoId=<%# Eval("VideoId") %>' ID="iThumbnailFileName" CssClass="content" />

我得到:

<span id="ctl00_mainContent_ucCoverFlow_rptVideos_ctl00_lbCatId">5</span>
<img id="ctl00_mainContent_ucCoverFlow_rptVideos_ctl01_iThumbnailFileName" class="content" href="Play.aspx?VideoId=&lt;%# Eval(&quot;VideoId&quot;) %>"
5

但是,当我使用:

<asp:Label id="lbCatId" runat="server" Text='<%# Eval("VideoId") %>' Visible="true" />
<asp:Image runat="server" href='Play.aspx?VideoId=<%# Eval("VideoId") %>' ID="iThumbnailFileName" CssClass="content" />

我得到:

<span id="ctl00_mainContent_ucCoverFlow_rptVideos_ctl00_lbCatId">5</span>
<img id="ctl00_mainContent_ucCoverFlow_rptVideos_ctl01_iThumbnailFileName" class="content" href="Play.aspx?VideoId=&lt;%# Eval(&quot;VideoId&quot;) %>"
您是否尝试过:

<asp:Image runat="server" href='<%# "Play.aspx?VideoId=" + Eval("VideoId") %>' ID="iThumbnailFileName" CssClass="content" />

尝试更改:

href='Play.aspx?VideoId=<%# Eval("VideoId") %>'
href='Play.aspx?VideoId='

href=''

尝试改用
ImageUrl
属性。
href
属性可能不知道如何解释数据绑定语法

<asp:Image ID="Image1" runat="server" ImageUrl='Play.aspx?VideoId=<%# Eval("VideoId") %>' ...>

您正在打印要执行的命令字符串,而不是执行它

使用:

“”
而不是:

 'Play.aspx?VideoId=<%# Eval("VideoId") %>'
“Play.aspx?VideoId=”

''

采用格式字符串的重载对于这类事情也很有用:“”