private void InitializeComponent() { DataTable dt = LoadTemplateFileDT(); string templateid = DNTRequest.GetString("templateid"); string templatename = DNTRequest.GetString("templatename").Replace(" ", "%20"); foreach (DataRow dr in dt.Rows) { string ext = dr["extension"].ToString().Substring(1); dr["filename"] = String.Format("<img src=../images/{0}.gif border=\"0\" style=\"position:relative;top:5 px;height:16 px\"> {1} " + "<a href=\"global_templatesedit.aspx?path={2}&filename={1}{3}&templateid={4}&templatename={5}\" title=\"编辑{1}.{0}模板文件\"><img src='../images/editfile.gif' border='0'/></a>", ext, dr["filename"].ToString().Trim(), dr["filepath"].ToString().Replace(" ", "%20"), dr["extension"].ToString().Trim(), templateid, templatename); } TreeView1.AddTableData(dt); for (int i = 0; i < TreeView1.Items.Count; i++) { TreeView1.Items[i].Attributes.Add("onclick", "checkedEnabledButton1(form,'TabControl1:tabPage22:CreateTemplate','TabControl1:tabPage22:DeleteTemplateFile')"); TreeView1.Items[i].Attributes.Add("value", TreeView1.Items[i].Value); } TreeView2.DataSource = LoadOtherFileDT(); TreeView2.DataBind(); }