mvc3 RenderAction传参问题

我在viewA中调用部分视图viewB
代码如下:@{Html.RenderAction("NewsList","News",new{pageSize=13, category = "company"});}
在viewB中接收viewA中传过来的参数pageSize和category 呢??

public PartialViewResult NewsList(int? id, int? pageSize, string category)
{

ViewData["pageSize"] = pageSize;//在前端直接使用这些对象就可以了!

ViewData["category"] = category;
PagedList<News> newlist = mynewsdb.newsInfo.Where(w => (w.Category == category)).OrderByDescending(o => o.ID).ToPagedList(id ?? 1, pageSize ?? 20);
if (Request.IsAjaxRequest())
{
return PartialView(newlist);
}
return PartialView(newlist);
}

 

posted on 2016-04-27 09:42  邬兴亮  阅读(410)  评论(0编辑  收藏  举报

导航