现在的位置: 首页 > 综合 > 正文

gridview换行

2013年03月01日 ⁄ 综合 ⁄ 共 467字 ⁄ 字号 评论关闭
在页面加入属性: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");
            }
        }

抱歉!评论已关闭.