前提是不能设置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
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