Datagrid column width manipulation

I have a datagrid which is connected to a dataview which is connected to a dataset.
I want to know how can I set EACH column width differently, something like : datagrid.column[0].width = 100, datagrid.column[1].width = 130, etc.
LagiAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
0
 
mpestCommented:
Do it from your aspx page, not the aspx.cs page

<asp:TemplateColumn HeaderText="Cost">
     <ItemTemplate>
          <asp:Label id="lblCost" runat="server" text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Cost")) %>' Width="75" />
     </ItemTemplate>
<asp:TemplateColumn>

Will set it to 75
0
 
LagiAuthor Commented:
The grid in within windows application not browser.
0
 
mpestCommented:
did you try
DG.Columns[0].HeaderStyle.Width = 100
0
All Courses

From novice to tech pro — start learning today.