我试图在一个转发器中显示图像和视频。 为此,我在我的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") %>' />
} %>
答案 0 :(得分: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") %>" />
答案 1 :(得分:-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") %>' />
<% } %>
答案 2 :(得分:-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") %>' />
<% } %>