protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "remove") { JuicDao dao = new JuicDao("MENU"); //刪除資料夾內檔案 //var MISupload = dao.GetMISupload(e.CommandArgument.ToString().Trim()); //if (MISupload.Rows.Count > 0) //{ string p_FilePath = e.CommandArgument.ToString().Trim(); System.IO.File.Delete(System.Web.Hosting.HostingEnvironment.MapPath(p_FilePath)); //} //刪除資料庫路徑 var DeleteMISupload = dao.DeleteMISupload(e.CommandArgument.ToString().Trim()); string strJS = "alert('刪除成功');location.href = ('MISserviceupload.aspx?pid=" + Request.QueryString["pid"].ToString() + "');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "", strJS, true); } }