当我使用:ASP.NET服务器标签
<asp:Label id="lbCatId" runat="server" Text='<%# Eval("VideoId") %>' Visible="true" />
我得到:
<span id="ctl00_mainContent_ucCoverFlow_rptVideos_ctl00_lbCatId">5</span>
然而,当我使用:
<asp:Image runat="server" href='Play.aspx?VideoId=<%# Eval("VideoId") %>' ID="iThumbnailFileName" CssClass="content" />
我得到:
<img id="ctl00_mainContent_ucCoverFlow_rptVideos_ctl01_iThumbnailFileName" class="content" href="Play.aspx?VideoId=<%# Eval("VideoId") %>"
我想知道为什么C#是不是产生了“视频ID就像是在第一个例子。
这工作得很好,谢谢你的回复。 –
接受格式字符串的重载对于这类事情也很有用:'<%#Eval(“VideoId”,“Play.aspx?VideoId = {0}”)%>' –