zoukankan      html  css  js  c++  java
  • Repeater中的“详细信息/简介”生成

    我们用Repeater生成一些列表时,对于一些较长的内容一般只会显示部分的信息,如只显示20个字。
    我是用以下方法实现的:


    在.aspx中

    <%# GenDescription(DataBinder.Eval(Container.DataItem,"Description"),20)%>




    在.cs中

    public string GenDescription(string description,int len)
            
    {
                
    if(description.Length==0)
                
    {
                    
    return "";
                }

                
    else if(description.Length>len)
                
    {
                    
    return description.Substring(0,len)+"";
                }

                
    else
                
    {
                    
    return description;
                }

            }

  • 相关阅读:
    集合
    字典
    列表
    事件兼容性封装
    E5中遍历数组的方法
    canvas绘制三等分饼型图
    canvas制作刮刮乐案例
    canvas绘制饼型图
    javascript中手风琴特效
    javascript中client()兼容性封装
  • 原文地址:https://www.cnblogs.com/bankey/p/939711.html
Copyright © 2011-2022 走看看