So far i am using this coding in the mvc 2 in controller page.
Here employeeInfoList = EmployeeInfoProxy.GetAllEmployeeInfo(TenantId);
employeeInfoList in that i geting the values of the particular ‘tenantid’ after that i wnat to assign it in the viewdata for the particular view…
so that is used valus.tolist() i am getting generic error…….
public ActionResult Edit(string TenantId)
{
try
{
Dictionary<string, EmployeeInfo> employeeInfoList = new Dictionary<string, EmployeeInfo>();
employeeInfoList = EmployeeInfoProxy.GetAllEmployeeInfo(TenantId);
if (employeeInfoList != null)
{
EmployeeInfo employee = employeeInfoList.Values.ToList(); //here i want to bind the values to the employeeinfo but genric error is cuming
ViewData["Department"] = employee.Department;
ViewData["Designation"] = employee.Designation;
ViewData["Address1"] = employee.Address1;
}
}
catch (Exception ex)
{
}
return View();
}
the ToList() method returns a List object, but you are trying to assign it to a single employeeInfo object.