protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string courseid = ((Label)GridView1.Rows[e.RowIndex].Cells[0].FindControl("Label1")).Text.ToString(); string coursename = ((Label)GridView1.Rows[e.RowIndex].Cells[0].FindControl("Label2")).Text.ToString(); string pathTopic = Server.MapPath(BusyworkManage.Path + Request.Cookies["TeacherID"].Value.ToString() + BusyworkManage.TopicPath + coursename); string pathBusywork = Server.MapPath(BusyworkManage.Path + Request.Cookies["TeacherID"].Value.ToString() + BusyworkManage.BusyworkPath + coursename); bm.DeleteAllFileInDir(pathBusywork); bm.DeleteAllFileInDir(pathTopic); bm.DeleteCourseByID(courseid); Databind(Request.Cookies["TeacherID"].Value.ToString()); }