protected void btnUpload_Click(object sender, EventArgs e) { try { if (ValidateImageUpload()) { Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster(); Entity.HR.EmployeeMaster employeeMaster = new Entity.HR.EmployeeMaster() { EmployeeMasterId = this.EmployeeMasterId, Image = (FileUpload1.HasFile) ? string.Concat(EmployeeMasterId.ToString(), System.IO.Path.GetExtension(FileUpload1.FileName)) : string.Empty }; int response = objEmployeeMaster.Employee_Update(employeeMaster); if (response > 0) { if (FileUpload1.HasFile) { FileUpload1.PostedFile.SaveAs(Server.MapPath(" ") + "\\EmployeeImage\\" + employeeMaster.Image); } MessageBox.IsSuccess = true; MessageBox.Text = "Image update successfully. Please clear browser cache to see."; MessageBox.Show = true; EmployeeMaster_ById(Convert.ToInt32(HttpContext.Current.User.Identity.Name)); } } } catch (Exception ex) { ex.WriteException(); } }