zoukankan      html  css  js  c++  java
  • datalist绑定字段后,截取部分字段方法,加省略号

    页面中:  <%#DataBinder.Eval(Container.DataItem,   "rcontent")%>  

    一、  把页面换成  
       
      <%#   GetShortContent(DataBinder.Eval(Container.DataItem,   "rcontent"))%>  
       
      然后在你的Code里面写   public   string   GetShortContent(object   obj){  
      //你的字符串处理操作  
      string strtemp=obj.ToString();
            if (strtemp.Length > 10)
            {
                strtemp = strtemp.Substring(0, 10)+"...";
            }
            return strtemp;

      }

    二、在提起数据的时候就:  
      select   substring(rtitle,0,10)   as   rtitle   from   你的表

    select   (case   when   len(你要判断的字段)>5   then   left(你要判断的字段,5)+'......'   else   你要判断的字段   end)   from

    Select    guid,      left(title,15) as title  from

  • 相关阅读:
    web.xml模板
    log4j.properties模板
    springmvc-config.xml模板
    applicationContext.xml配置druid连接池
    mybatis-config.xml模板
    mapper.xml模板
    Servlet基础认识
    单例模式的懒汉饿汉
    霜降小悟
    忙闲有致
  • 原文地址:https://www.cnblogs.com/mxh691/p/1224577.html
Copyright © 2011-2022 走看看