hello my friend, thanks for view my question, I was confused, I was searching a way to view my folders structure, mark a folder and get your Path, I was thinking use DataGridView or something similar, I found ASP.NET TreeView Control and is perfect for my.
<asp:TreeView Id="MyTree" PathSeparator = "/" ExpandDepth="0" runat="server"
OnSelectedNodeChanged="TreeView1_SelectedNodeChanged" ImageSet="Arrows"
AutoGenerateDataBindings="False">
<SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px"
ForeColor="#5555DD">
</SelectedNodeStyle>
<NodeStyle VerticalPadding="0px" Font-Names="Tahoma" Font-Size="10pt"
HorizontalPadding="5px" ForeColor="#000000" NodeSpacing="0px">
</NodeStyle>
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD">
</HoverNodeStyle>
</asp:TreeView>
<br />
<asp:Label ID="Label1" runat="server" Text="Carpeta Seleccionada: "></asp:Label>
<br />
<asp:Label id="ruta" runat="server"></asp:Label>
if (Page.IsPostBack == false)
{
System.IO.DirectoryInfo RootDir = new System.IO.DirectoryInfo(Server.MapPath("~/01Carpetas_Productos"));
// output the directory into a node
TreeNode RootNode = OutputDirectory(RootDir, null);
// add the output to the tree
MyTree.Nodes.Add(RootNode);
}
}
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
this.ruta.Text = "~/" + MyTree.SelectedNode.ValuePath.ToString();
}
TreeNode OutputDirectory(System.IO.DirectoryInfo directory, TreeNode parentNode)
{
// validate param
if (directory == null) return null;
// create a node for this directory
TreeNode DirNode = new TreeNode(directory.Name);
// get subdirectories of the current directory
System.IO.DirectoryInfo[] SubDirectories = directory.GetDirectories();
// OutputDirectory(SubDirectories[0], "Directories");
// output each subdirectory
for (int DirectoryCount = 0; DirectoryCount < SubDirectories.Length; DirectoryCount++)
{
OutputDirectory(SubDirectories[DirectoryCount], DirNode);
}
if (parentNode == null)
{
return DirNode;
}
else
{
parentNode.ChildNodes.Add(DirNode);
return parentNode;
}
}
with this code bit, I can get folder path(any folder), and show path in label, for after use that path in another operation
thanks and regards.