473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

width of column in DataGrid remains the same

Hi,

I'm using a DataGrid (in a Webform) for which I create custom-columns.

BoundColumn organizationCol = new BoundColumn();
organizationCol.HeaderText = "Organization";
organizationCol.DataField = m_hashTable[strOrganization].ToString();
organizationCol.ItemStyle.Width = 50;
dataGrid1.Columns.Add(organizationCol);

OK, correct values are shown whe n I run the app but the only thing that is
not correct is the width of the column.

The width of the column is always set to length of the Headertext, no matter
what value I set 'organizationCol.ItemStyle.Width' to.

So
organizationCol.ItemStyle.Width = 100;
organizationCol.ItemStyle.Width = 500;
...
the width always remains the same (width of the headerText)

How can I solve this ? I want the width of my column to be set to the value
I choose.

Thnx

Chris

Nov 18 '05 #1
1 1077
the width of a column in a html table (what the grid control generates), is
the width of widest column. set the width on the header also, and specify an
overflow style or it won't make any difference.

-- bruce (sqlwork.com)
"Chris" <ch********@pandora.be> wrote in message
news:iE*********************@phobos.telenet-ops.be...
Hi,

I'm using a DataGrid (in a Webform) for which I create custom-columns.

BoundColumn organizationCol = new BoundColumn();
organizationCol.HeaderText = "Organization";
organizationCol.DataField = m_hashTable[strOrganization].ToString();
organizationCol.ItemStyle.Width = 50;
dataGrid1.Columns.Add(organizationCol);

OK, correct values are shown whe n I run the app but the only thing that is not correct is the width of the column.

The width of the column is always set to length of the Headertext, no matter what value I set 'organizationCol.ItemStyle.Width' to.

So
organizationCol.ItemStyle.Width = 100;
organizationCol.ItemStyle.Width = 500;
...
the width always remains the same (width of the headerText)

How can I solve this ? I want the width of my column to be set to the value I choose.

Thnx

Chris

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TPSreport | last post by:
ASP.NET 2003. Two DataGrids, six columns each, one grid atop the other. I need to have the columns line up, i.e., DataGrid1 Col(1) lined up w/ DataGrid2 Col(1) - each the same width on the...
5
by: Prateek | last post by:
Hi, How can I change the width of a column in datagrid control? TIA Prateek
2
by: Hajash | last post by:
hi all, how do i set the width of a column in a datagrid.Please help.Thanks in advance. regards, hajash
9
by: web1110 | last post by:
Hi y'all, I have resized the columns in a DataGrid and I want to set the width of the DataGrid to fit the columns. Just summing the column widths is too short due to the grid and gray row...
1
by: Chris | last post by:
Hi, I'm using a DataGrid (in a Webform) for which I create custom-columns. BoundColumn organizationCol = new BoundColumn(); organizationCol.HeaderText = "Organization";...
1
by: martin | last post by:
Hi, I have a datagrid that contains 3 colums. This is rendered to the page fine, except that I would like to be able to control the width of each table cell of the datagrid I have the following...
1
by: Drew | last post by:
Hey, thanks in advance for helping me out with my problem: I have a datagrid which is embedded in another datagrid. The datagrid is filled directly by a dataset generated from a sql query. So...
3
by: Aziz | last post by:
1. I have a shopping basket DataGrid with a list of products. What I want to do is when the user clicks on a row, a button will become visible/be created that allows user to edit the quantity. The...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.