HTML FileUpload 重置寫法

jquery - Flie Upload Clearing File input Value Individually - Stack Overflow

GridView Container.DataItemIndex 用法

<asp:GridView ID="GridView1" runat="server" EnableModelValidation="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="ShowRowIndex" Text="Click" CommandArgument='<%# Container.DataItemIndex %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
view raw GridView.aspx hosted with ❤ by GitHub
Protected Sub GridView1_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GridView1.RowCommand
If (e.CommandName = "ShowRowIndex") Then
Response.Write(Convert.ToInt32(e.CommandArgument))
End If
End Sub
view raw RowCommand.vb hosted with ❤ by GitHub
c# - ASP.NET GridView RowIndex As CommandArgument - Stack Overflow

File Filter (async & sync)

var fs = require('fs'),
path = require('path'),
strWorkPath = 'E:/Test',
aryFolderPath = fs.readdirSync(strWorkPath);
for (var i = 0; i < aryFolderPath.length; i++) {
//判斷是資料夾
if (fs.statSync(path.join(strWorkPath, aryFolderPath[i])).isDirectory()) {
//撈出全部檔案
var files = fs.readdirSync(path.join(strWorkPath, aryFolderPath[i]));
//過濾jpg檔
files.map(function(file) {
return path.join(strWorkPath, aryFolderPath[i], file);
}).filter(function(file) {
return fs.statSync(file).isFile() && path.extname(file) === '.jpg';
}).forEach(function(file) {
console.log(file);
});
}
}
/* Reslut
E:\Test\FolderA\1.jpg
E:\Test\FolderB\2.jpg
E:\Test\FolderC\3.jpg
*/
view raw async.js hosted with ❤ by GitHub
E:\TEST
├─FolderA
│ ├─1.jpg
│ └─FileA.txt
├─FolderB
│ ├─2.jpg
│ └─FileA.txt
└─FolderC
├─3.jpg
└─FileB.txt
view raw Folder Tree.txt hosted with ❤ by GitHub
var fs = require('fs'),
path = require('path'),
strWorkPath = 'E:/Test';
fs.readdir(strWorkPath, function(err, folders) {
if (err) {
throw err;
}
folders.map(function(folder) {
return path.join(strWorkPath, folder);
}).filter(function(folder) {
return fs.statSync(folder).isDirectory();
}).forEach(function(folder) {
fs.readdir(folder, function(err, files) {
if (err) {
throw err;
}
files.map(function(file) {
return path.join(folder, file);
}).filter(function(file) {
return fs.statSync(file).isFile() && path.extname(file) === '.jpg';
}).forEach(function(file) {
console.log(file);
});
});
});
});
/* Reslut
E:\Test\FolderA\1.jpg
E:\Test\FolderB\2.jpg
E:\Test\FolderC\3.jpg
*/
view raw sync.js hosted with ❤ by GitHub