private void InitialDataPopup() { var cmd = new DepartmentService(); var list = cmd.GetALL(); foreach (var item in list) { ddlDepartment.Items.Add(new ListItem(item.DEPARTMENT_NAME, item.DEPARTMENT_ID.ToString())); } if (ViewState["empId"] != null) { var cmdEmp = new EmployeeService(); _employee = cmdEmp.Select(Convert.ToInt32(ViewState["empId"].ToString())); if (_employee != null) { popTxtEmployeeCode.Text = _employee.EMPLOYEE_CODE; txtName.Text = _employee.EMPLOYEE_NAME; txtLastName.Text = _employee.EMPLOYEE_SURNAME; ddlDepartment.SelectedValue = _employee.DEPARTMENT_ID.ToString(); flag.Text = "Edit"; } var cmdFunc = new ZoneDetailService(); DataSouceRoleFunction = cmdFunc.GetALLInclude(_employee.EMPLOYEE_ID); } else { DataSouceRoleFunction = new List<ZONE_DETAIL>(); } DataSouceRoleFunction.AddRange(DataSouceNewRoleFunction); gridZone.DataSource = DataSouceRoleFunction; gridZone.DataBind(); }