ViewBag 用法
1.首先在controller中给ViewBag 赋值:
public ActionResult ScannedDigitaldocumentList() { var noticeList = noticeManage.GetNoticeList(new Notice { AutIntNo = autIntNo, NotTicketNo = Request.QueryString["SearchStr"] }, page_index, page_size, out record_count); ViewBag.Notices = noticeList;
return View(); }
2.在前台显示:
<div id="ljj"> @{ foreach (var notice in ViewBag.Notices) { var ss = notice.NotIntNo.ToString() + ','; @ss }
} </div>