我尝试了不同的“属性”:
我将ItemStyle-Wrap设置为“true”。 我使用css类:
.wraptext
{
word-wrap:break-word;
-ms-word-wrap: break-word;
-moz-word-wrap: break-word;
-webkit-word-wrap: break-word;
}
这对我没有帮助。我的GridView:
<asp:Panel ID="Panel2" Height="570px" Width="100%" runat="server" ScrollBars="Vertical" BackColor="White">
<asp:GridView ID="tableResults" runat="server" DataSourceID="sourceDetails"
AutoGenerateColumns="False" OnDataBound="tableResults_Bound"
OnRowDataBound = "tableResults_DataBound" DataKeyNames="i_id"
AutoGenerateDeleteButton="True" OnRowDeleted="tableResults_RowDeleted"
AutoGenerateEditButton = "True" OnRowUpdating="tableResults_RowUpdating"
OnRowUpdated="tableResults_RowUpdated" AllowSorting="true" AllowPaging="true" PageSize="150"
Height="300px" BorderStyle="None" Font-Size="12px">
<RowStyle BorderColor="Black" />
<Columns>
<asp:TemplateField HeaderText="Код патча" SortExpression="patchcode" ItemStyle-Width="4%">
<HeaderStyle Width="4%" />
<ItemTemplate>
<asp:Label Width="4%" ID="lblPatchCode" runat="server" Text='<%# Eval("patchcode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderStyle-Width="3%" ItemStyle-Width="3%" DataField="i_number" ReadOnly="true" HeaderText="П/п" SortExpression="i_number"/>
<asp:BoundField HeaderStyle-Width="20%" ItemStyle-CssClass="wraptext" ItemStyle-Width="20%" DataField="s_name" ReadOnly="true" HeaderText="Наименование работы" SortExpression="s_name"/>
<asp:TemplateField HeaderText="Статус" SortExpression="status" ItemStyle-Width="7%">
<HeaderStyle Width="7%" />
<ItemTemplate>
<asp:Label ID="lblStatus" runat="server" Text='<%# Eval("status")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblStatus" runat="server" Text='<%# Eval("status")%>' Visible = "false"></asp:Label>
<asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="ddl_OnSelectedIndexChanged"
ID="ddlStatuses" runat="server"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
答案 0 :(得分:0)
CSS3 word-wrap Property是一项CSS3功能,因此仅适用于支持css3的现代浏览器word-wrap
对于非支持性浏览器的回退,请使用.NET GridView
与页面隐藏中的Eval
和public
方法结合使用以打破字母。