473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing width of a datagrid column dynamically

I would like to change the width of a datagrid column at run time.

I have noticed when creating a datagrid, if the header text is shorter
than the data in the column, then the column width set by the framework
is only wide enough to accomodate the data. The data is packed so closly
together
it is hard to read.

I have tried changing this in the dg_itemdatabound event but ran into a
problem. The e.Item.Cells(1).Width property is in units and it seems it
cannot be cast into an interger for manipulating.

So is there a way to change the width of a datagrid column or more
specifically make the column a little wider than the data
*** Sent via Developersdex http://www.developersdex.com ***
Apr 17 '06 #1
1 2042
Veeves wrote:
I would like to change the width of a datagrid column at run time.
[...]
I have tried changing this in the dg_itemdatabound event...


DataGrid controls and itemdatabound events belong to .NET, I think you
should ask in a .NET news group.
--
Rob
Apr 17 '06 #2

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

Similar topics

1
1979
by: Stephen | last post by:
I have a datagrid and i'm trying to fix the width of one of the columns to be exactly 300px. My problem is that one of the records fields(CompanyName) is really long and has no spaces so it...
1
11593
by: | last post by:
How do I change the datagrid column width dynamically when the grid's being loaded? VM
1
3236
by: Amos | last post by:
Can I add a column to the datagrid and also resize it? I add them like this: DataTableAddress.Columns.Add("Col1", typeof(string)); DataTableAddress.Columns.Add("Col2", typeof(string));...
9
3929
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...
5
3625
by: VB Programmer | last post by:
I have a simple datagrid on a webform. (I'm using VB.NET.) In the page load I get some data, set the .DataSource property of the dg, then do a .DataBind. The columns are automatically created. ...
1
2136
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...
5
2206
by: Joko suprianto | last post by:
Hi, i want to ask how to set the width of each of the column on the datagrid. im using vb.net because from what i know in vb.net we have DataGrid1.TableStyles(0).GridColumnStyles(2).width = 150...
3
4667
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...
1
15025
by: savajx1 | last post by:
I need to dynamically create a set of bound fields contained in a GridView control. I also have a single static CommandField that I can declare in the Columns <tagof the GridView control. I have...
0
7233
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
7135
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
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7410
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...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.