C#截取字符串

Posted on 2013-08-07 08:46  !sylar  阅读(90)  评论(0)    收藏  举报

p.title.Length>15?p.title.Substring(0,14)+"....":p.title;

 

grid.Column("Title", "标题", format: p => Html.Raw(string.Format("<a href='Home/Content/{0}'>{1}</a>", p.ID, (p.Title.Length > 26 ? p.Title.Substring(0, 25) + "..." : p.title))), style: "g-txt"),