私はさまざまな「プロパティ」を試します:
- ItemStyle-幅
- ControlStyle-幅
- HeaderStyle-幅
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>