前提是不能设置GridView的列宽(可以设置表头的宽度代替列宽)
把下面代码加到Me.objGv.DataBind()下面
'GridView表头强制不换行
objGv.HeaderRow.Style.Add("word-break", "keep-all")
'GridView内容强制不换行
Fori AsInteger=0ToobjGv.Rows.Count -1
Forj AsInteger=0ToobjGv.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内容强制不换行
Fori AsInteger=0ToobjGv.Rows.Count -1
Forj AsInteger=0ToobjGv.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