Reputation: 27
I am trying to show both image and Video in a single repeater. For that i am using if else inside my aspx page. But this is not return any value. Can anyone help me to resolve the issue?
<% 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") %>' />
} %>
Upvotes: 0
Views: 1300
Reputation: 5672
Try something like this instead;
<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") %>" />
Upvotes: 4
Reputation: 216
Use it like this...
<% 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") %>' />
<% } %>
Upvotes: -1
Reputation: 13755
try this
<% 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") %>' />
<% } %>
Upvotes: -1