後臺動態新增超連結實現點選檔案實現下載
阿新 • • 發佈:2019-01-04
protected void Page_Load(object sender, EventArgs e) { string path = "~/Document/Introduction/團隊管理制度/"; DirectoryInfo dirinfo = new DirectoryInfo(Server.MapPath(path)); FileInfo[] Files = dirinfo.GetFiles(); for (int i = 0; i < Files.Length; i++) { //Files[i].CreationTime Literal literal = new Literal(); literal.Text = "</br></br>"; Panel1.Controls.Add(literal);//實現換行顯示 HyperLink hypelink = new HyperLink(); hypelink.NavigateUrl = path + Files[i].Name; hypelink.Text = Files[i].Name; Panel1.Controls.Add(hypelink); } }