Thank you for your concern,
At first, I've tried at first to select folder by using FileUpload control, but we can only choose files but not any folder through that.
And I've used TreeView control to populate the directories starting from the "My Computer" as default start-up path of the current user. But I couldn't get the my computer (this pc) path of Windows 8.
protected void Page_Load(object sender, EventArgs e)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
TreeView1.Nodes[0].Value = path;
}
protected void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
if (IsCallback)
{
if (e.Node.ChildNodes.Count == 0)
{
DirectoryInfo directory = null;
directory = new DirectoryInfo(e.Node.Value);
foreach (DirectoryInfo subtree in directory.GetDirectories())
{
TreeNode subNode = new TreeNode(subtree.Name);
subNode.Value = subtree.FullName;
try
{
if (subtree.GetDirectories().Length > 0 | subtree.GetFiles().Length > 0)
{
subNode.SelectAction = TreeNodeSelectAction.SelectExpand;
subNode.PopulateOnDemand = true;
subNode.NavigateUrl = "#";
}
}
catch
{
}
e.Node.ChildNodes.Add(subNode);
}
foreach (FileInfo fi in directory.GetFiles())
{
TreeNode subNode = new TreeNode(fi.Name);
e.Node.ChildNodes.Add(subNode);
subNode.NavigateUrl = "Images/" + fi.Name.ToString();
}
}
}
}