gridview换行

在页面加入属性:style =" word-break :break-all ; word-wrap:break-word "  (table或div 等的属性里)

或设置
        protected void GridView1_DataRowBound(object o, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //设置要换行的模板列
               e.Row.Cells[0].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");
                e.Row.Cells[1].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");
            }
        }
posted @ 2007-05-30 10:32 星际 阅读(1068) 评论(1) 编辑 收藏