If you wan't a fixed width then try setting the
ControlStyle-Width
and
HeaderStyle-Width
in your ItemTemplate column.
If you want to wrap the content of a TextBox within ItemTemplate Column, you can try this hack:
ASPX:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Text='<%# Bind("ColumnName") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
CODE BEHIND:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((TextBox)e.Row.FindControl("TextBox1")).Attributes.Add("style", "word-break:break-all;word-wrap:break-word");
}
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((TextBox)e.Row.FindControl("TextBox1")).Width = new Unit(50);
}
}