Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3442030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:37:21+00:00 2026-05-18T08:37:21+00:00

So far i am using this coding in the mvc 2 in controller page.

  • 0

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(); 
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:37:21+00:00Added an answer on May 18, 2026 at 8:37 am
    EmployeeInfo employee = employeeInfoList.Values.ToList();
    

    the ToList() method returns a List object, but you are trying to assign it to a single employeeInfo object.

    Dictionary<string, EmployeeInfo> employeeInfoList = new Dictionary<string, EmployeeInfo>(); 
        employeeInfoList = EmployeeInfoProxy.GetAllEmployeeInfo(TenantId); 
    
        if (employeeInfoList != null) 
        { // assuming you really only want the first one.  What if GetAllEmployeeInfo() returns more than one employee???
          EmployeeInfo employee = employeeInfoList.Values.FirstOrDefault(); 
          ViewData["Department"] = employee.Department; 
          ViewData["Designation"] = employee.Designation; 
          ViewData["Address1"] = employee.Address1; 
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So far, I'm doing this programmatically using VB.net/ASP.net: <table cellspacing=0 cellpadding=4 border=0 style=border- width:0px;width:100%;border-collapse:collapse;font-size:12px;>
I'm using v4.0. Update: I've hacked together this so far: public class AllFilter :
I'm using Linq2Sql for my asp.net mvc project and so far it has worked
I realize that this rule might differ from one company's coding standards to another,
hai Friends I am using this coding for validating the emailID online through webservice
Hai Freinds So far i have used this coding to create a custom Control
So far I've been using public void run() {} methods to execute my code
So far I've been using SVN, and now is in need to pick up
thus far i've only been using some basic jquery selectors and functions. but i'm
So far I have learned about generating thread dump and heap dump using jstack

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.