I have a code block that does not return the expected data values.
protected void Page_Load(object sender, EventArgs e)
{
corpEmployee.Employee editEmp = new corpEmployee.Employee();
editEmp.EmployeeID = PatientCustomerID.Value;
corpCustomerMgr.GetEmployeeRecord(editEmp);
tboxFirstName.Text = editEmp.EmpFirstName.ToString();
tboxLastName.Text = editEmp.EmpLastName.ToString();
tboxCity.Text = editEmp.EmpCity.ToString();
tboxAddress.Text = editEmp.EmpAddrLine1.ToString();
}
public static void GetEmployeeRecord(corpEmployee.Employee QueryData)
{
try
{
List<corpEmployee.Employee> empRecord = new List<corpEmployee.Employee>();
corpCustomerDAL.GetEmployeeData(empRecord, QueryData);
}
catch (Exception ex)
{
LogAppError(ex.ToString());
}
}
When corpCustomerDAL.GetEmployeeData(empRecord, QueryData); is executed, empRecord is returned with the Employee object with correct property values. However, when the code comes back to corpCustomerMgr.GetEmployeeRecord(editEmp); the employee object has null values.
How can I get the Employee object values back to the Page_Load routine?
Based on your comments, it looks like you are populating
empRecordwith the employee data you require. The simplest option is to return the populated record fromGetEmployeeRecord:You should then change the start of your
Page_Loadhandler to: