i create a loop to show a list
- <table>
- <tr>
- <th>th>
- <th>TeleGUID
- th>
- <th>Screen Name
- th>
- <th>Mobile Number
- th>
- tr>
- @foreach (var item in Model)
- {
- <tr>
- <td>
- @Html.ActionLink("Edit", "Edit", new { id = item.TeleGUID }) %> |
- @Html.ActionLink("Details", "Details", new { id = item.TeleGUID })%>
- td>
- <td>
- @Html.DisplayFor(modelItem => item.TeleGUID)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.TeleName)
- td>
- <td>
- @Html.DisplayFor(modelItem => item.TeleMob)
- td>
- tr>
- }
- table>
controller code is
- [HttpGet]
- public ActionResult UserDetails()
- {
- UserdbEntities db = new UserdbEntities();
- var tasks = from t in db.UserInfoes
- select new
- {
- t.GUID,
- t.Name,
- t.Mob,
- };
- return View(tasks.ToList());
but i got an error
Pooja ChowdhuryPosted Sep 7, 2017, 3:24 AM
the error is
he model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MvcApplication3.TeleInfo]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[MvcApplication3.Models.MTeleInfo]'.
Pooja ChowdhuryPosted Sep 4, 2017, 8:09 AM
Kailash PolaiPosted Aug 31, 2017, 12:20 PM
Pooja ChowdhuryPosted Aug 30, 2017, 1:50 AM
Kailash PolaiPosted Aug 29, 2017, 2:47 AM
Pooja ChowdhuryPosted Aug 26, 2017, 3:12 AM
Mobeen RashidPosted Aug 24, 2017, 3:09 AM