关于GridView中列的值自动换行或不换行

控制GridView某一列换行:

在RowDataBound中加上e.Row.Cells[2].Style.Add("word-break", "break-all")

控制所有列换行:

protected void Page_Load(object sender, EventArgs e)
    {
        //正常换行
        GridView1.Attributes.Add("style", "word-break:keep-all;word-wrap:normal");
        //下面这行是自动换行
        GridView1.Attributes.Add("style", "word-break:break-all;word-wrap:break-word");
        if (!IsPostBack)
        {
             bind();//调用数据绑定即可
        }
    }
View Code
原文地址:https://www.cnblogs.com/chenls/p/4303305.html