Code BehindProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) ' make a reference to a directory Dim DirPath As New IO.DirectoryInfo("C:\\My_Website\My_Folder") Dim FCollect As IO.FileInfo() = DirPath.GetFiles() Dim FInfo As IO.FileInfo 'list the names of all files in the specified directory For Each FInfo In FCollect 'bind url to line item - create hyperlink Dim LnItem = New ListItem(FInfo.ToString, "http://www.mywebsiteurl.com/" + My_Folder/" & FInfo.ToString) 'create bulleted list BulletedList1.Items.Add(LnItem) 'open url in new window BulletedList1.Target = "_blank" Next End Sub
Markup page<form id="form1" runat="server"> <div style="padding-left: 20px;"> <asp:bulletedlist ID="BulletedList1" runat="server" DisplayMode="HyperLink" > </asp:bulletedlist> </div> </form>
List Directory Content with Bulleted List Hyperlink – VB.NET
Tags: ASP.NET, bulleted, list, Visual Studio