前端不濟 找了一個簡單的插件地址http://sc.chinaz.com/jiaoben/130509308250.htm
這是實體類
public class TimnAxis : BaseEntity<int> { [Required(ErrorMessage = "{0}是必須的")] [Display(Name = "時間")] public DateTime Time { get; set; } [Required(ErrorMessage = "{0}是必須的")] [Display(Name = "標題")] [StringLength(50, ErrorMessage = "長度必須少於{1}個字")] public string Title { get; set; } [Required(ErrorMessage = "{0}是必須的")] [Display(Name = "內容")] [StringLength(1000, ErrorMessage = "長度必須少於{1}個字")] public string Content { get; set; } }
[HttpGet] public ActionResult TimnAxis(bool isAll=false) { ViewBag.WebInfo = webInfo; List<TimnAxis> timnAxises=new List<TimnAxis>(); if (isAll) { timnAxises = ItimnAxisManager.FindList().OrderBy(t => t.Time).ToList(); } else { timnAxises = ItimnAxisManager.FindList().OrderBy(t => t.Time).Take(30).ToList(); } return View(timnAxises); }
依賴的腳本和循環出內容
@section style { <link rel="stylesheet" type="text/css" href="/Content/timeaxis/css/default.css" /> <link rel="stylesheet" type="text/css" href="/Content/timeaxis/css/component.css" /> } @section scripts { <script src="/Content/timeaxis/js/modernizr.custom.js"></script> }
<div class="main "> <ul class="cbp_tmtimeline"> @{ foreach (var item in Model) { <li> <time class="cbp_tmtime" datetime="2013-04-18 09:56"> <span>個人博客地址 http://www.yhyboy.top/