Asp.net traverses all subfolders in the folder and binds them to the gridview. asp. netgridview
Traverse all subfolders in the folder, traverse all keys and values in a node of the configuration file, and bind them to the GridView.
Helper app_Helper = new Helper (); DataSet ds = new DataSet (); DataTable dt = new DataTable (); protected void Page_Load (object sender, EventArgs e) {gvwBind ();} # region bind the GridView // <summary> /// bind the GridView // </summary> protected void gvwBind () {INI. INIPath iniINIPath = new INI. INIPath (); INI. INIFile iniINIFile = new INI. INIFile (iniINIPath. getINIPath (); string FolderNames = app_Helper.GetAll Folder (Server. mapPath (".. /.. /APPDIR "); // obtain the names of all subfolders in the appdir folder string [] FolderName = new string [FolderNames. split (','). length-1]; // declare an array to save the absolute path of the folder FolderName = FolderNames. split (','); // assign dt to the absolute path array of the folder. columns. add ("LKNAME", typeof (string); dt. columns. add ("qdjsjm", typeof (string); dt. columns. add ("qdipdz", typeof (string); for (int I = 0; I <FolderName. length-1; I ++) {DataRow row = dt. newRow (); FolderName [I] = FolderName [I]. substring (FolderName [I]. lastIndexOf ('\') + 1); // capture the folder name row ["LKNAME"] = FolderName [I]; // assign an if (! IniINIFile. iniReadValue ("dzjclkzp", FolderName [I]). equals ("") // check whether the key with the same folder name exists in the configuration file {row ["qdjsjm"] = iniINIFile. iniReadValue ("dzjclkzp", FolderName [I]). split (',') [0]; // assign row ["qdipdz"] = iniINIFile to the qdjsjm field. iniReadValue ("dzjclkzp", FolderName [I]). split (',') [1]; // assign a value to the qdipdz field} dt. rows. add (row);} gvwGKWH. dataSource = dt; // bind it to the array gvwGKWH. dataBind () ;}# endregion binds the GridView
Hurry up, aspnet C # traverse the files in the folder and bind the file name to the GridView. How can I write the download path to download these files?
Just output the files on the server to the client as a stream.
Aspnet (c #) traverses a folder with TreeView. How can I click a node to open the file?
Now that you have traversed the folder
Add it cyclically in the selectedChanged event
System. Diagnostics. Process. Start ("f: \ a.txt ");
Next, just traverse it again and try again. Wish you success.