How to display the Directory names in the Repeater Control

Platform: ASP.NET| Category: Repeater

Use namespace System.IO


<asp:Repeater id='Repeater1' runat='server'>
<ItemTemplate >
	<%# DataBinder.Eval(Container.DataItem, 'Name').ToString() %>
</ItemTemplate>
</asp:Repeater>

VB.NET


Dim dir As New DirectoryInfo(Server.MapPath('.'))
Repeater1.DataSource = dir.GetDirectories
Repeater1.DataBind()

C#


DirectoryInfo dir = new DirectoryInfo(Server.MapPath('.'));
Repeater1.DataSource = dir.GetDirectories();
Repeater1.DataBind();

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.