About
Pricing
Community
Teams
Start Free Trial
Log in
Lagi
asked on
2/19/2003
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.
C#
4
1
Last Comment
mpest
8/22/2022 - Mon
mpest
2/19/2003
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(DataBinde
r.Eval(Con
tainer.Dat
aItem,"Cos
t")) %>' Width="75" />
</ItemTemplate>
<asp:TemplateColumn>
Will set it to 75
ASKER CERTIFIED SOLUTION
Éric Moreau
2/19/2003
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Lagi
2/20/2003
ASKER
The grid in within windows application not browser.
mpest
2/20/2003
did you try
DG.Columns[0].HeaderStyle.
Width = 100
Your help has saved me hundreds of hours of internet surfing.
fblack61
<asp:TemplateColumn HeaderText="Cost">
<ItemTemplate>
<asp:Label id="lblCost" runat="server" text='<%# Convert.ToString(DataBinde
</ItemTemplate>
<asp:TemplateColumn>
Will set it to 75