asp.net column gridview widths
satya - Friday, May 18, 2007 5:45:09 PM
Setting widths on server side
public class ColumnHeaderTemplate : ITemplate
{
    private string columnname;
    private string displayname;
    public ColumnHeaderTemplate(string inColumnname, string inDisplayName)
    {
        displayname = inDisplayName;
        columnname = inColumnname;
    }
    public void InstantiateIn(Control container)
    {
        Label test = new Label();
        test.Text = this.displayname;
        LiteralControl lc = new LiteralControl("<p/>");
        TextBox tb = new TextBox();
        tb.Style.Value = "display:block;";
        tb.ID = this.columnname;
        tb.Width = Unit.Percentage(100);
        container.Controls.Add(test);
        container.Controls.Add(tb);
    }
}//eof-class
satya - Friday, May 18, 2007 5:49:14 PM
you can find unit methods here
satya - Friday, May 18, 2007 5:50:23 PM
in brief
Percentage: Creates a Unit of type Percentage from the specified double-precision floating-point number.
Pixel: Creates a Unit of type Pixel from the specified 32-bit signed integer.
Point: Creates a Unit of type Point from the specified 32-bit signed integer.
satya - Friday, May 18, 2007 5:52:57 PM
A template field example
<asp:TemplateField HeaderText="Team Name" ItemStyle-Width="10%" >
   <ItemTemplate>
   <asp:Label ID="Label1" 
         Text='<%#getValue(Container.DataItem,"TEAM_NM") %>' 
      runat="server"/>
   </ItemTemplate>
</asp:TemplateField>
satya - Friday, May 18, 2007 5:54:56 PM
The absolute textboxes can mess up the percentage widths
The absolute textboxes can mess up the percentage widths. I used a percentage width for the textbox so that it will take a percentage of the table column it is sitting in. with out this I saw the table not honoring the widths that are in the aspx page.