mvc返回多个结果集,返回多个视图
System.Web.Mvc.ViewPage<dynamic>//这句不清楚到底有没有用,反正我没用到 public ActionResult Index() { IDictionary<string, object> entity = new Dictionary<string, object>();//声明一个字典健值对 List<CiclSingerPic> lpc = new List<CiclSingerPic>();//实体一 List<MSingerPage> lsp = new List<MSingerPage>();//实体二 List<CiclNews> lcn = new List<CiclNews>();//实体三 Dictionary<object, object> dne = new Dictionary<object, object>();//健值对。 lpc = new ProductLogic().ReadHomeMessage(ref lsp, ref dne, ref lcn);//从Model中取值给上面声明的实体及健值对 entity.Add("topb", lpc);//添回到IDictionary entity.Add("about", lsp);//添回到IDictionary entity.Add("dnes", dne);//添回到IDictionary entity.Add("lcn", lcn);//添回到IDictionary return View(entity);//返回视图 } @foreach (var item in (IList<CiclEntity.CiclSingerPic>)Model["topb"])//实体1 { <li><a href="@item.LinkHtml" target="_blank"><img src="@item.ImbBig" alt="@item.Expression" /></a></li> } @{Html.RenderAction("SubString", "public", new { id = ((IList<CiclEntity.MSingerPage>)Model["about"])[2].CContent });} //实体二 @foreach (var item in (Dictionary<object, object>)Model["dnes"])// { <li><a href="/title.html/@item.Key">@item.Value</a></li> }