protected void DeleteFile(object sender, EventArgs e) { string employeeID = Convert.ToString(txtEid_LV.Text); Int64 EMP_ID = Convert.ToInt64(lblHiddenId.Text); //string rootPath = Server.MapPath("../HRM/File/"); //string filePath = (sender as LinkButton).CommandArgument; //string fullPath = rootPath + filePath; //File.Delete(fullPath); //Response.Redirect(Request.Url.AbsoluteUri); ServiceBLL sv = new ServiceBLL(); LinkButton imgbtn = (LinkButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; try { string FilePath = ""; Label lblfileID = (Label)grd_File.Rows[row.RowIndex].FindControl("lblfileID"); if (lblfileID != null) { FilePath = lblfileID.Text; int result = sv.FilePathDEleting(FilePath); if (result == 1) { BindGridEmployee(employeeID); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }