这是新闻标题长度截断处理的问题,因为用控件绑定数据非常不好判断和处理字段的长度,所以最好能在客户端(JAVASCRIPT)自动判断截断过长的新闻标题,因为FF不支持TEXT-OVERFLOW,所以基本可以否定CSS方法,最好能用JAVASCRIPT脚本来处理。
望高手指点,举个小例子说明一下更好,谢谢!
最后祝解放军攻台顺利!

解决方案 »

  1.   

    最简单的办法就是在后台截取,利用sql语句直接截取。substring函数
      

  2.   

    用控件绑定也好处理的
       比如 gridview 有个RowDataBound事件
      可以在这里面处理   用e.Row.Cells来得到当前行的数据
     
     
      

  3.   

    我也遇到过这种问题,不过我是在服务器端解决的,在在绑定之前判断字符串大小是否超过指定长度,如果超过就对字符串采用SubString方法。
      

  4.   


     <asp:repeater runat="server" ID="arts_1" OnDataBinding="arts_1_DataBinding">
     <headertemplate> </headertemplate>
            itemtemplate>
                             <a href="" target="_blank">
                              <a  href ="<%#DataBinder.Eval(Container.DataItem,"title") %>">
            <%#DataBinder.Eval(Container.DataItem,"title").ToString().Length>11?DataBinder.Eval (Container.DataItem,"title").ToString().Substring(0,12):DataBinder.Eval (Container.DataItem,"title").ToString().Substring(0,7) %>
    ....</a></a>                      </itemtemplate>
                          <footertemplate> </footertemplate>
                        </asp:repeater>