0

我试图在一个中继器中同时显示图像和视频。为此,我在我的 aspx 页面中使用 if else 。但这不是返回任何值。谁能帮我解决这个问题?

<%  if('<%#Eval("UploadType").%> == "V"')
{
  <embed src='<%# Eval("FilePath") %>' 
     type="application/x-shockwave-flash" 
     allowscriptaccess="always" 
     allowfullscreen="true" width="150" height="150"></embed>
}
else
{
    <asp:ImageButton ID = "ibtnHolder" runat = "server" 
        Width = "130" Height = "130" 
        ImageUrl = '<%# Eval("FilePath") %>' />
} %>
4

3 回答 3

4

试试这样的东西;

<embed src='<%# Eval("FilePath") %>' 
    type="application/x-shockwave-flash" 
    allowscriptaccess="always" 
    allowfullscreen="true" 
    width="150" height="150" runat="server" 
    Visible="<%= Eval("UploadType") == "V") %>"></embed>

<asp:ImageButton ID="ibtnHolder" runat="server" 
    Width="130" Height="130" 
    ImageUrl='<%# Eval("FilePath") %>' 
    Visible="<%= Eval("UploadType") != "V") %>" />
于 2012-02-24T13:28:33.277 回答
-1

试试这个

<%  if( <%# (Eval("UploadType") == "V") %> )
{ %>
    <embed src='<%# Eval("FilePath") %>' 
        type="application/x-shockwave-flash" 
        allowscriptaccess="always" 
        allowfullscreen="true" width="150" height="150"></embed>
<% }
else
{ %>
    <asp:ImageButton ID = "ibtnHolder" runat = "server" 
        Width = "130" Height = "130" 
        ImageUrl = '<%# Eval("FilePath") %>' />
<% } %>
于 2012-02-24T13:28:28.793 回答
-1

像这样使用它...

 <%  if('<%#Eval("UploadType").%> == "V"')
{ %>
<embed src='<%# Eval("FilePath") %>' 
    type="application/x-shockwave-flash" 
    allowscriptaccess="always" 
    allowfullscreen="true" width="150" height="150"></embed>
<% }
else
{ %>
<asp:ImageButton ID = "ibtnHolder" runat = "server" 
    Width = "130" Height = "130" 
    ImageUrl = '<%# Eval("FilePath") %>' />
<% } %>
于 2012-02-24T13:30:21.850 回答