AddaByte    Programmers' Script Repository
Free and low cost software.
spacer
Find out about our beautiful fractal backgrounds at abm-enterprises


Newsletter Signup
Name
Email
 

  ASP.Net - Resize Datagrid Column
 


Save up to 75% on software

Drive Clone

the best name in hosting


Two methods but second one is usually the do-all end-all:
use the headerstyle attribute in the grid definition:
<asp:TemplateColumn HeaderStyle-Width="20">
  <ItemTemplate>
    <asp:LinkButton id="cmdEditVersions" runat="server" Text="Edit" CommandName="Edit" CausesValidation="false"></asp:LinkButton>
  </ItemTemplate>
</asp:TemplateColumn>

or at the end of your itemdatabound codebehind function:
public void dgYourGridName_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{        
	dgYourGridName.Columns[5].ItemStyle.Width = new Unit(20, UnitType.Pixel);
	dgYourGridName.Columns[6].ItemStyle.Width = new Unit(30, UnitType.Pixel);
	dgYourGridName.Columns[7].ItemStyle.Width = new Unit(45, UnitType.Pixel);
	dgYourGridName.Columns[8].ItemStyle.Width = new Unit(30, UnitType.Pixel);

}
  What does it do?
   no description given
 
  Features
  Added by Added Downloads Rating Popularity

  rpgivpgmr

5:22:38 AM Tuesday, March 31st 2009

12

not rated

 
 
  About the file
  Size Download Rate It  

  916 KB
  download this file
 
 
  Comments
no comments
 
  Add your comment
 Email  
 Subject  
 Comment  
 Verification code:

 
    All comments are screened by the admin prior to being posted
     
 
  Contacts
  Report Abuse