protected void btn_move_Click(object sender, EventArgs e) { for (int i = 0; i < GridView2.Rows.Count; i++) { CheckBox cb = new CheckBox(); cb = (CheckBox)GridView2.Rows[i].FindControl("cbSel"); if (cb.Checked) { string name = GridView2.DataKeys[i].Value.ToString().Substring(GridView2.DataKeys[i].Value.ToString().LastIndexOf("/") + 1).ToUpper(); CY.HotelBooking.Core.Business.Web_Xml xml = new CY.HotelBooking.Core.Business.Web_Xml(); string webPath = Server.MapPath("~/ADIMG/"); System.IO.FileInfo file = new System.IO.FileInfo(webPath + name); file.Delete(); xml.DeleteElement(webPath, "~/ADIMG/" + name); } } string tablename = IMGType.SelectedItem.Value; dataBind(tablename); GridView2.DataBind(); }