Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to get information or data of tables and
and show in partial view. Now my action for Partial View is
<pre lang="xml">public ActionResult _ListPartialNavbarPageGroup()        {
         var db = new eShopMVCEntities();
         var Query = (from title in db.PageGroups
                      select title).ToList();
         return View(Query.AsEnumerable());
     }</pre>


and my partial view page is
<using System.Data
@model IEnumerable<eshopfull.models.pagegroups>

>

and may layout call this partialview

< @Html.Partial("~/Views/PageGroups/_ListPartialNavbarPageGroup.cshtml",new PageGroups())>

Now .... I Call Home page . Home page include top partial view ..
may home conroller and index is ...
public ActionResult Index()
{

    return View();
}

but Error
<of type 'System.Collections.Generic.IEnumerable`1[EshopFull.Models.PageGroups]'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The model item passed into the dictionary is of type 'EshopFull.Models.PageGroups', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[EshopFull.Models.PageGroups]'.

Source Error:


Line 67: // *@
Line 68:
Line 69: @Html.Partial("~/Views/PageGroups/_ListPartialNavbarPageGroup.cshtml",new PageGroups())
Line 70:
Line 71:
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900