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");
            }
        }

你可能感兴趣的:(GridView)