?
Solved

Datagrid column width manipulation

Posted on 2003-02-19
4
Medium Priority
?
179 Views
Last Modified: 2010-04-15
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.
0
Comment
Question by:Lagi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:mpest
ID: 7982901
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
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 400 total points
ID: 7982902
0
 

Author Comment

by:Lagi
ID: 7988121
The grid in within windows application not browser.
0
 
LVL 1

Expert Comment

by:mpest
ID: 7989919
did you try
DG.Columns[0].HeaderStyle.Width = 100
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question