cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Document Widget to list files in Folder

Andy_Sismey
Champion Sweeper III
Hi

Not sure if this is any use to anyone but this widget will display a list of documents / files in a given folder, handy to display Work Instructions ?

<%@ Page Language="C#" AutoEventWireup="true" Inherits="LS.BaseControl" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="LS.Enums" %>

<%@ Import Namespace="System.IO" %>

<%@ Import Namespace="LS" %>



<% Response.CacheControl = "no-cache";%>

<% Response.AddHeader("Pragma", "no-cache"); %>

<% Response.Expires = -1; %>

<% LS.User.Current().CheckUserWebsiteAccess(); %>
<%string foldername="\\\\Server\\Work-Instructions";%>
<%System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(foldername);%>
<%int count = dir.GetFiles().Length;%>
<ul> <% foreach(var file in Directory.GetFiles(foldername, "*.*", SearchOption.AllDirectories)) { %>
<%FileInfo fi =new FileInfo(file);%>
<%long size = fi.Length; %>
<%if (size > 0){ %>

<%string FileDoc = Path.GetFileName(file);%>
<li><a href="http://Server/WidgetsCustom/Work-Instructions/<%=Path.GetFileName(file)%>"</a><%=FileDoc%> - <%=size %>kb</li>
<%} }%>
</ul>



<script type="text/javascript">

$('#WTitle<%=TabControlID %>', window.top.document).text("Work Instructions:=<%=count %>");

</script>
0 REPLIES 0