hi
I just tried the iewc treeviw and i tried one exemple (it's not mine).look:
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Page language="c#" Codebehind="ietreeview.aspx.cs" AutoEventWireup="false" Inherits="IETreeView.IETreeView" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ietreeview</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<iewc:TreeView id="treeDirectory" runat="server" ImageUrl="images/dir.gif" ExpandedImageUrl="images/dir_open.gif">
<iewc:TreeNodeType ImageUrl="images/text.gif" ID="Document" Type="Document"></iewc:TreeNodeType>
<iewc:TreeNodeType ImageUrl="images/xmldoc.gif" ID="xmlDoc" Type="XmlDoc"></iewc:TreeNodeType>
<iewc:TreeNodeType ImageUrl="images/aspxdoc.gif" ID="aspxDoc" Type="AspxDoc"></iewc:TreeNodeType>
<iewc:TreeNodeType ImageUrl="images/vbdoc.gif" ID="VBDoc" Type="vbDoc"></iewc:TreeNodeType>
<iewc:TreeNodeType ImageUrl="images/csdoc.gif" ID="CSDoc" Type="csDoc"></iewc:TreeNodeType>
<iewc:TreeNodeType ImageUrl="images/resx.gif" ID="ResxDoc" Type="resxDoc"></iewc:TreeNodeType>
<iewc:TreeNodeType ImageUrl="images/img.gif" ID="Image" Type="img"></iewc:TreeNodeType>
<iewc:TreeNode Text="Root" ID="RootNode"></iewc:TreeNode>
</iewc:TreeView>
<br>
</form>
</body>
</HTML>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using Microsoft.Web.UI.WebControls;
namespace IETreeView
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class IETreeView : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TreeView treeDirectory;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
PopulateTreeView(MapPath(""), treeDirectory.GetNodeFromIndex("0"));
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void PopulateTreeView(string strDirectory, TreeNode nodeParent)
{
try
{
DirectoryInfo CurDir = new DirectoryInfo(strDirectory);
DirectoryInfo[] DirArray;
FileInfo[] FilesArray;
DirArray = CurDir.GetDirectories();
FilesArray = CurDir.GetFiles();
//DirectoryInfo curdirInfo;
//FileInfo curfileInfo;
foreach (FileInfo curfileInfo in FilesArray)
{
TreeNode newFileNode = new TreeNode();
newFileNode.Text = curfileInfo.Name;
if(curfileInfo.Extension == ".xml")
{
newFileNode.Type = "XmlDoc";
}
else if(curfileInfo.Extension == ".aspx")
{
newFileNode.Type = "AspxDoc";
}
else if(curfileInfo.Extension == ".vb")
{
newFileNode.Type = "vbDoc";
}
else if(curfileInfo.Extension == ".cs")
{
newFileNode.Type = "csDoc";
}
else if(curfileInfo.Extension == ".gif")
{
newFileNode.Type = "img";
}
else if(curfileInfo.Extension == ".resx")
{
newFileNode.Type = "resxDoc";
}
else
{
newFileNode.Type = "Document";
}
nodeParent.Nodes.Add(newFileNode);
}
foreach (DirectoryInfo curdirInfo in DirArray)
{
TreeNode newDirNode = new TreeNode();
newDirNode.Text = curdirInfo.Name;
string strDir;
strDir = curdirInfo.FullName;
nodeParent.Nodes.Add(newDirNode);
PopulateTreeView(strDir, newDirNode);
}
}
catch(UnauthorizedAccessException)
{
TreeNode node = new TreeNode();
node.Text = "Access Denied!";
nodeParent.Nodes.Add(node);
}
}
}
}
un look which is the result (WHYYYYYYYYYY)
Root AssemblyInfo.cs Global.asax Global.asax.cs Global.asax.resx ietreeview.aspx ietreeview.aspx.cs ietreeview.aspx.resx IETreeView.csproj IETreeView.csproj.webinfo IETreeView.sln IETreeView.suo Web.config bin IETreeView.dll IETreeView.pdb microsoft.web.ui.webcontrols.dll images aspxdoc.gif csdoc.gif dir.gif dir_open.gif img.gif resx.gif text.gif vbdoc.gif xmldoc.gif _vti_cnf _vti_pvt access.cnf deptodoc.btr doctodep.btr service.cnf service.lck services.cnf _vti_script _vti_txt
Can someone tell me why?this isn't the rigth result.
Thanks.