Setting the width of a column in a datagrid contro

I want to customize the look of the grid,<BR>how can I do that?You can set the datagrid width property to set the total grid width, but so far, no one has came up with a way to specify the width of individual columns. Look over the posting at the bottom of 4/08/02 ~ 4/10/02 for some prior conversations.<BR><BR>Good luck.<BR>If you find a way to set individual columns, please post.<BR><BR>Tom TThis should do it for you:<BR><BR><asp:BoundColumn HeaderText="Date" DataField="Date" DataFormatString="{0:d}"><BR> <HeaderStyle Width="10%"/><BR> </asp:BoundColumn><BR><BR>Here it is in Context:<BR><BR><asp:DataGrid id="TheData" runat="server"<BR> GridLines="vertical"<BR> border="0px"<BR> cellpadding="3"<BR> cellspacing="1"<BR> width="100%"<BR> AutoGenerateColumns="False"><BR> <Columns><BR> <asp:BoundColumn HeaderText="Date" DataField="Date" DataFormatString="{0:d}"><BR> <HeaderStyle Width="10%"/><BR> </asp:BoundColumn><BR> <asp:templateColumn HeaderText="Title"><BR> <ItemTemplate><BR> <a href=http://aspmessageboard.com/archive/index.php/"edit.aspx?id=<%# Container.DataItem("ID") %>"><%# Container.DataItem("Title") %></a><BR> </ItemTemplate><BR> </asp:templatecolumn><BR> </Columns><BR></asp:datagrid><BR><BR>Hope that works for you!<BR><BR>-Nick<itemStyle Width="150"/> rather than headerStyle if you like.<BR><BR>Like so:<BR><BR><asp:BoundColumn HeaderText="Date" DataField="Date" DataFormatString="{0:d}"><BR><itemStyle Width="150"/><BR></asp:BoundColumn><BR><BR>])ryThanks a lot all<BR>For me <ItemStyle width="theWidth" /> was the way to go
 
Back
Top