1
List<string> allFiles = new List<string
allFiles.AddRange(Directory.GetFiles(@"C:\test1\*"));
allFiles.AddRange(Directory.GetFiles(@"C:\test2\*"));
yourGV.DataSource = allFiles;
yourGV.DataBind();
1
Try this.
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Uploads/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
files.Add(new ListItem(Path.GetFileName(filePath), filePath));
}
GridView1.DataSource = files;
GridView1.DataBind();
Modify if you need filter result
1
hey,
http://www.aspdotnet-suresh.com/2013/08/c-get-all-files-from-folder-and.html
http://www.c-sharpcorner.com/blogs/display-images-in-gridview-from-folder-in-asp-net1
0
You Welcome, Happy Coding !!!!!
Accept Right answer. So it will help next person.
0
Hi,
R u saving the name or path of the document in the db
just visit the link it may help you
http://www.aspsnippets.com/Articles/Display-list-of-files-from-Server-folder-in-ASPNet-GridView.aspx
http://www.aspdotnet-suresh.com/2014/07/aspnet-display-list-of-files-from-server-folder-in-gridview.html