to: newfans(笨猫)
但是单元格中即使是汉字,也还有这样的情况发生

解决方案 »

  1.   

    在后台对帮定数据做取舍,比如截取限定长度的string
      

  2.   

    如果不截取长度string,该如何解决?
      

  3.   

    或者你限定了datagrid的高度。height=1?
      

  4.   

    加样式就可以了.如下:
    style="WORD-BREAK: break-all"
      

  5.   

    to:shuncy(天才笨蛋)
    datagrid 中加入style="WORD-BREAK: break-all"样式没作用。
    <asp:datagrid id=DataGrid1 style="Z-INDEX: 101;WORD-BREAK: break-all; LEFT: 9px; POSITION: absolute; TOP: 54px" runat="server" BorderColor="White" Font-Names="Arial" Font-Size="9pt" AllowPaging="True" DataKeyField="UserID" DataMember="Employee" DataSource="<%# dataSet11 %>" CellSpacing="1" BorderStyle="Ridge" BorderWidth="2px" BackColor="White" CellPadding="3" GridLines="None" AutoGenerateColumns="False">
      

  6.   

    大家觉得在<Columns>中设置Width的值的方式可行不可行?
    我试过了,的确可以,但感觉有点繁琐
      

  7.   

    你可以换一种方式添加,你原来添加到了整个表格中去了,
    如下即可:
    在ItemDataBound事件中写入:
    e.Item.Cells[i].Style.Add("WORD-BREAK","break-all");
    其中:i为你想让它自动换行的列
      

  8.   

    to:shuncy(天才笨蛋) 
    具体如何写法,我参照sdk文档写的有错误,麻烦你告知一下,
      

  9.   

    我写得很明白了呀,假设你的DataGrid列为
    name |  adress | re | 
    现在你想在re列处自动换行,那么
    在DataGrid的ItemDataBound事件中如下写:
    if(e.Item.ItemIndex >= 0)
    {
        e.Item.Cells[2].Style.Add("WORD-BREAK","break-all");
    }