显示的时候截取20个 字符,或者直接在sql里截取
public static string getleft(string scatitle,int cid) //从左截取串 scatitle 的 cid个字符
{
string rtn = "" ;
if(scatitle.Trim().Length>cid)
{
rtn = scatitle.Substring(0,cid) + "..." ;
}
else
{
rtn = scatitle ;
}
return rtn ;
}
调用:
<%#getleft(DataBinder.Eval(Container.DataItem, "News_Title").ToString(),20)%>