This code tip reads in a directory of files, determines if the file date not older than 180 days and displays various image's. This builds a string and passes it to a Literal control.
<!%@ Import Namespace="system.IO" %> <!%@ Register TagPrefix="Top" TagName="TopStuff" Src="toppage.ascx" %> <!%@ Register TagPrefix="Bottom" TagName="BottomStuff" Src="bottompage.ascx" %> <!script language="vb" runat="server">
Sub Page_Load(Sender as Object, E as EventArgs) ...This code tip reads in a directory of files, determines if the file date not older than 180 days and displays various image's. This builds a string and passes it to a Literal control. [code] <%@ Import Namespace="system.IO" %> <%@ Register TagPrefix="Top" TagName="TopStuff" Src="toppage.ascx" %> <%@ Register TagPrefix="Bottom" TagName="BottomStuff" Src="bottompage.ascx" %> <script language="vb" runat="server">
Sub Page_Load(Sender as Object, E as EventArgs) Dim dir As DirectoryInfo = New DirectoryInfo("d:webrootbigdogs") Dim files As FileInfo() = dir.GetFiles() Dim count As Integer = files.Length Dim i As Integer dim daFiles as string For i = 0 To count - 1 Dim theDate As Integer = DateDiff(DateInterval.Day, files(i).CreationTime, Date.Today) If theDate < 180 Then daFiles = daFiles & "<li><img src=new.gif'><a href='" & files(i).Name & "'>" & files(i).Name & "</a></li>" Else daFiles = daFiles & "<li><a href='" & files(i).Name & "'>" & files(i).Name & "</a></li>" End If Next
jokes.Text = "</ul>" & daFiles End Sub </script> <html> <head> <title>Big Dogs</title> </head> <body background="/images/pawsback.gif"> <Top:TopStuff TitleOfDemo=" list new Gif File" runat="server" />
<asp:Literal id="jokes" runat="server" />
<bottom:bottomstuff runat="server" />
</body> </html>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP.NET Code Articles More By aspfree developerWorks - FREE Tools! | Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
| | | | Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services. FREE! Go There Now!
| | | | In this five-part "Building a grid system using WS-Resource Transfer" series, we look at the use of WS-Resource Transfer (WS-RT) in different areas of the grid environment -- from using it as a method for storing and recovering general information about grid-to-grid monitoring and management, and security. We also examine how WS-RT can be used for the distribution and division of work. In any grid, there is a huge amount of metadata about the grid that needs to be stored and distributed. Using WS-RT makes sharing the information, especially the precise information required by different systems in the grid, significantly easier. Here in Part 4, we look at both sides of the security session, both in terms of using WS-RT as an aid to the authorization process and at combining WS-Security with WS-RT for secure resource exchange. FREE! Go There Now!
| | | | Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms. FREE! Go There Now!
| | | | Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects. FREE! Go There Now!
| | | | Ubuntu is a great server and desktop distribution for the GNU/Linux operating system, but did you know that it's also ideal for handheld and mobile embedded devices? Ubuntu's latest release, Gutsy Gibbon, now includes support for the embedded and mobile spaces with the Ubuntu Mobile and Embedded (UME) project. Get to know the UME project, and find out how to get started. FREE! Go There Now!
| | | | This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
| | | | Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
| | | | Learn how IBM Rational Tester for SOA Quality addresses IBM WebSphere MQ with Web services. You get hands-on experience in creating a test, handling the WebSphere MQ series protocol, configuring the test, and then replaying it. FREE! Go There Now!
| | | | The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |