private void del_Click(object sender, System.EventArgs e)
{
foreach(TableRow tr in this.listfile.Rows)
{
CheckBox chk = (CheckBox)tr.Cells[0].Controls[0];
if(chk.Checked)
{
try
{
string path = Server.MapPath(chk.Attributes["Path"].ToString());
if(Convert.ToBoolean(chk.Attributes["IsFile"]) == true)
{
File.Delete(path);
}
else
{
Directory.Delete(path,true);
}
}
catch(System.Exception ex)
{
throw new Exception(ex.Message);}
}
}}
注: 将this.listfile  改为 this.listfile.Rows 应该就可以了.