How to Set a gridview column width when binding to a datatable
        Posted  
        
            by Bob Avallone
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bob Avallone
        
        
        
        Published on 2010-04-29T21:19:14Z
        Indexed on 
            2010/04/30
            10:57 UTC
        
        
        Read the original article
        Hit count: 557
        
I am binding a table to a gridview in asp.net as such
grdIssues.DataSource = mdtIssues;
grdIssues.DataBind();
The problem is I cannot then control the column width, asp.net seems to decided on it's own what width each column should be. Methods such as
grdIssues.Columns[0].ItemStyle.Width = 100; grdIssues.Columns[1].ItemStyle.Width = 100;
don't work because the columns are created dynamically. I cannot believe there isn't a way to do this short of manually creating each column and filling each row.
Regards,
Bob Avallone
© Stack Overflow or respective owner