Text='<%# Eval("CoachPreTitle").ToString().Length >=14?Eval("CoachPreTitle").ToString().Substring(0,12)+"....":Eval("CoachPreTitle").ToString()%>'
或是直接在cs中写方法截取长度
我现在用的:
public static DataSet RemindList(Int32 RemindYear)
{
DataSet ds = null;
String sSql = "select a.RemindID,a.RemindTitle,a.RemindTime,a.RemindContent from (select RemindID,RemindTitle,RemindTime,RemindContent,(select datepart(year,RemindTime) ) as RemindYear from dbo.vwForWeb_Remind) a where a.RemindYear="+RemindYear+" order by RemindID DESC ";
ds = ULCode.XSql.MsSql.GetDataSet(sSql);
ULCode.Data.XDataTable xdt = ULCode.XSql.XDS(ds);
xdt.l("RemindTitle", 30);
xdt.l("RemindContent", 46);
ds = xdt.ToDataSet();
xdt = null;
return ds;
}
l为字符串截取方法