Show message if FileGenie Folder List is empty Support
Question:
How can I check if the FileGenie FolderList is empty and have a message appear?
Answer:
Sometimes you might have a Folder List from a folder that does not contain any files. In that case empty space would appear and a user is not sure if this supposed to happen or not. With FileGenie there is an option to check if the Folder List is empty and then display a message using an If-statement.
Start with creating a Folder List and have the content of this list appear on a page by creating a Folder List Repeater or a Folder List Table. Create an If-statement right before the location of the Folder List Repeater code or the Folder List Table code. Insert the code If MyFolderList.Count = 0 into this If-Statement. Next, type a message that should appear when the Folder List is empty. In our example the text No files found will show. Insert the Else code. Scroll down and put the End If code below the code of the Folder List Repeater or the Folder List Table code
Your complete code should look like this.
<% If MyFolderList.Count = 0 Then %>
No files found
<% Else %>
<ul>
<%
' *** Folder List Repeater Start
while MyFolderList.CanRepeat()
%>
<li>
<%= MyFolderList.Files("Name") %></li></ul>
<%
MyFolderList.MoveNext
wend
' *** Folder List Repeater End
%>
<% End If %>
That's basically it. Preview the result on a live page and see what happens!
I'd really appreciate your feedback on your results! If you have any more questions just let me know!
Comments
Be the first to write a comment
You must me logged in to write a comment.