Hi,
Please can someone help me how to re-direct if the "file description" is NOT empty.
<a href="<%# Eval("FileDescription") %>" > <img src="<%# GetFileUrl("FileAttachment") %>" alt="<%# Eval("FileName") %>" style="width: 100%; " class="img-responsive" >
If file description is empty I want to add below line
<img src="<%# GetFileUrl("FileAttachment") %>" style="width: 100%; height: 100%; " class="img-responsive" >
Below is my full code.
Thank you!
Since you're using ASCX type best would be to use the ASP placeholder way.
Somthing like you can see below. The 'your code' part only gets rendered when FileDescription equals the empty string.
<asp:PlaceHolder ID="ph1" runat="server" Visible='<%# Eval("FileDescription").ToString().Equals("") %>'> // your code </asp:PlaceHolder>
Thanks David. I am not using ASCX. Is there another way of doing this?
so your using text xml tranformaiton type?
as your examples don't work in this either.
in for the XML transformations you'll need something like:
{% if (String.IsNullOrEmpty(FileDescription) { ... } else { ... } %}
Have you explored the Reference - Transformation methods that Kentico has. I think you should be able to use the IfEmpty method to achieve what you want.
E.g. <%# IfEmpty(Eval("FileDescription"), "Description Empty", Eval("FileDescription")) %>
Please, sign in to be able to submit a new answer.