我一直使用Gridview来显示数据。i使用Itemstyle设置每一列的宽度,但问题是,如果该列的内容大于列宽,则它会自动增加列宽,但我想打破单词,如果内容大于列,请width...plz帮助我……
发布于 2020-11-20 13:32:42
CSS样式"overflow-wrap: break -word;“将强制换行,即使单元格内容中没有空格,因此应该可以这样做:
<style>
.bigcols td {
max-width:410px;
overflow-wrap:break-word;
}
</style>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="bigcols" DataSourceID="SqlDataSource1">
....应该能行得通。
https://stackoverflow.com/questions/7789765
复制相似问题