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>

 

posted @ 2015-03-05 13:46  heidi_liu  阅读(547)  评论(0编辑  收藏  举报