有没有哪个属性可以设置?现在会自动换行,把格子拉长,影响页面布局

解决方案 »

  1.   

    据说用CSS可以搞定,但不知道怎么搞
    那就还是用程序解决吧,如:
    <%# Eval("邦定字段").ToString().Length > 10 ? Eval("邦定字段").ToString().Substring(0,20) : Eval("邦定字段") %>
      

  2.   

    楼上那种方法我也用过,个人感觉很不方便,不知道c#有没有vb里的left这类函数
      

  3.   

    想用VB的LEFT,那就引用进去用LEFT吧。
      

  4.   

    protected void GridView1_RowDataBound(object sender,GridViewRowEventArgs e)
    {
        if(e.Row.RowType == DataControlRowType.DataRow)
        {
           if(e.Row.Cells[1].Text).Length>6)
           {
                e.Row.Cells[1].Text = (e.Row.Cells[1].Text).Substring(0,6)+"...";
            }
            if(e.Row.Cells[0].Text).Length>6)
           {
                e.Row.Cells[0].Text = (e.Row.Cells[0].Text).Substring(0,6)+"...";
            }
        }
       省略...
    }