public void BindUserToUpdate() { SecureUsersModel model = _client.EditUserbyID(SecureUserId, Request.QueryString["CompanyParlourID"] != null ? CompanyParlourId : ParlourId); if ((model == null) || (model.parlourid != ParlourId || model.parlourid != CompanyParlourId)) { Response.Write("<script>alert('Sorry!you are not authorized to perform edit on this User.');</script>"); } else { CompanyParlourId = model.parlourid; SecureUserId = model.PkiUserID; txtUserNameUser.Text = model.UserName; txtPasswordpass.Attributes.Add("value", model.Password); //ParlourId = model.parlourid; txtSurname.Text = model.EmployeeSurname; txtFullName.Text = model.EmployeeFullname; txtIDNumber.Text = model.EmployeeIDNumber; txtCellPhone.Text = model.EmployeeContactNumber; txtline1.Text = model.EmployeeAddress1; txtline2.Text = model.EmployeeAddress2; txtline3.Text = model.EmployeeAddress3; txtline4.Text = model.EmployeeAddress4; //System.DateTime.Now = model.LastModified; //UserName = model.ModifiedUser; txtUserNameUser.Text = model.Email; txtpostalcode.Text = model.Code; // txtAgentName.Text = model.AgentName; //txtAgentSurname.Text = model.AgentSurname; /* changes for custom field implemented on 10th April 2017*/ ddlCustom1.SelectedValue = model.CustomId1.ToString(); ddlCustom2.SelectedValue = model.CustomId2.ToString(); ddlCustom3.SelectedValue = model.CustomId3.ToString(); /* changes for custom field implemented on 10th April 2017 completed*/ ddlBankBranch.SelectedValue = model.BranchId.ToString(); SecureUserGroupsModel[] modelS = _client.EditSecurUserbyID(SecureUserId); foreach (ListItem lst in chkSecurityGroup.Items) { lst.Selected = false; } foreach (SecureUserGroupsModel lstModel in modelS) { foreach (ListItem lst in chkSecurityGroup.Items) { if (Convert.ToInt32(lst.Value) == lstModel.fkiSecureGroupID) { lst.Selected = true; } } } btnSubmite.Text = @"Update"; } }