GridView强制不换行

前提是不能设置GridView的列宽(可以设置表头的宽度代替列宽)

把下面代码加到Me.objGv.DataBind()下面

 

'GridView表头强制不换行
objGv.HeaderRow.Style.Add("word-break""keep-all")
'GridView内容强制不换行
For i As Integer = 0 To objGv.Rows.Count - 1
    
For j As Integer = 0 To objGv.Rows(i).Cells.Count - 1
        objGv.Rows(i).Cells(j).Wrap 
= False
        objGv.Rows(i).Cells(j).Style.Add(
"word-break""keep-all")
    
Next
Next
posted @ 2008-07-21 14:10  不待人亲灬  阅读(2730)  评论(0编辑  收藏  举报