您的位置:首页 > 其它

如何实现GridView表格数据限制标题换行

2013-10-19 16:07 323 查看
//限制标题换行
e.Row.Cells[1].Attributes.Add("style",
"word-break :break-all ; word-wrap:break-word");
激活RowCreated事件

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)

        {

            if (e.Row.RowType == DataControlRowType.DataRow)

            {

                e.Row.Cells[1].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");

                e.Row.Cells[2].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");

                e.Row.Cells[3].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");

                e.Row.Cells[4].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");

                e.Row.Cells[6].Attributes.Add("style", "word-break :break-all ; word-wrap:break-word");

            }

        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: