public ActionResult Index()
{
List<pInfo> pobj = new List<pInfo>();
pobj = (from pid in db.pInfoes
orderby pid.pId descending
select pid).ToList();
return View(pobj);
}
public ActionResult toprank() ///partial view
{
List<pInfo> pobj = new List<pInfo>();
pobj = (from pid in db.pInfoes.Where(c => c.DateCreated < DateTime.Now)
orderby pid.Score descending
select pid).Take(3).ToList();
return PartialView("toprank", pobj);
}
\\\ Index.csHtml
@model IEnumerable<TestProj.pInfo>
<table>
<tr>
<td>
@foreach (var item in Model)
{
<table>
<tr>
<td>
<iframe width="560"
height="300"
src="@item.pUrl"
frameborder="0"></iframe>
</td>
</tr>
</table>
}
</td>
<td>
@{Html.RenderPartial("toprank", model);}
</td>
</tr>
</table>
I am passing different result set for same Model i.e pInfo. on partial view and Index actionresult on the Home Controller. When I am trying to render the partial view on the Index view page I am getting the same result-set from the Index action result two times one in the table and another in the @{Html.RenderPartial("toprank", model);} ... I am sure I am missing some basic understanding of how the partial view works but unable to figure it out for last 3 hrs. If I change the url to partial view i.e (home/toprank ) then I get the resultset I want but its not coming on the Home/Index page
Please let me know if my design concept is wrong.. I am starting to feel that this is probably the wrong approach to get this working..