I have a GridView where text in cells wrap in the middle if the cell (not utilizing the complete width of the cell). In the properties of the "BoundFields" definition I have set wrap = false. I also tried this:
Code:
GridView2.DataSource = Nothing
GridView2.DataSource = MaterialDetailDataTable
GridView2.DataBind()
GridView2.Style.Item("wrap") = False
But it still wraps.
So how do I tell the GridView to use full cell width and not to wrap (in code behind)? Thank you.
Code:
<asp:GridView ID="GridView2" runat="server" Style="z-index: 10px; position: relative; top: 43px; border-right: gray thin solid; border-top: gray thin solid; border-left: gray thin solid; border-bottom: gray thin solid; font-size: 12px; left: 10px;" Width="518px" AllowPaging="True" AllowSorting="True" Font-Size="Small" AutoGenerateColumns="False" CellSpacing="2"
HorizontalAlign="Left" BorderColor="LightGray" BorderStyle="None" PageSize="14" OnSorting="GridView2_Sorting">
<Columns>
<asp:BoundField DataField="job_date" DataFormatString="{0:d}" HeaderText="Date" SortExpression="job_date" HtmlEncode="False">
<ItemStyle HorizontalAlign="Center" Width="20px" />
</asp:BoundField>
<asp:BoundField DataField="item_number" HeaderText="Cost Code" HtmlEncode="False">
<ItemStyle HorizontalAlign="Left" Width="30px" />
</asp:BoundField>
<asp:BoundField DataField="source_name" HeaderText="Source Name">
<ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="product_name" HeaderText="Product Name">
<ItemStyle HorizontalAlign="Left" Width="90px" Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="item_qty" HeaderText="Quantity">
<ItemStyle HorizontalAlign="Right" Width="30px" Wrap="False" />
</asp:BoundField>
<asp:ButtonField CommandName="notes" DataTextField="item_notes" HeaderText="Notes"
Text="notes" >
<ItemStyle Width="80px" Wrap="False" />
</asp:ButtonField>
</Columns>
<HeaderStyle BackColor="#FFC080" Height="35px" />
<AlternatingRowStyle BackColor="#FFFFC0" />
<RowStyle Height="20px" Wrap="False" />
<SelectedRowStyle BackColor="#FF8080" Wrap="False" />