TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
nisha asha
NA
3
5.1k
How to do a Asp.net Mvc Grouping By Linq and pass to view
Jul 9 2015 3:14 AM
I have Grouped Via Linq in Mvc , Grouped and stored in var ,When i pass to view i have got error?
Error is : Its in generic list, Requires Igrouping dictionary type?
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[System.Linq.IGrouping`2[System.String,AngularCrudS.Empinfo]]', but this dictionary requires a model item of type 'System.Linq.IGrouping`2[System.String,AngularCrudS.Empinfo]'.
Anyone help pls
controller:
public class HomeController : Controller
{
public SQLChallengeEntities Sqlcontext = new SQLChallengeEntities();
public ActionResult GroupBy()
{
var EmpDesignationGrouped = Sqlcontext.Empinfoes.ToList().GroupBy(x => x.EmpDesignation).ToList();
return View(EmpDesignationGrouped);
}
View:
@model IGrouping<string,AngularCrudS.Empinfo>
{
ViewBag.Title = "GroupBy";
}
<h2>GroupBy</h2>
@foreach (var s in Model)
{
@s.EmpDesignation
foreach (var e in s.)
{
}
}
}
i am not able to put second foreach where i make the mistake
Reply
Answers (
3
)
bind controls
how to get select row using jquery for a gridtable