473,385 Members | 1,553 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,385 software developers and data experts.

Datagrid Column Widths - This should be easier

I am missing something obvious here. I have a simple grid with 2 columns
pulled from an ADO.NET ODBC datasource. All that I want to do is lengthen
the columns in the grid so each field displays completely. Somehow
it appears the order in which you set your grid properties determines
whether
it can get it to work. I know I can write code to do this, but since I was
able
to get the table styles to take effect in design mode (at one point), I know
it's possible.
I have the data set and data adapter already configured.
What to I set first when I build the grid?
The Datasource?
The Tablestyles?
Do I set a mapping name for the table style?
What to I make the Data grid column style mapping name, the column name?

What order do I have to set these things so the column widths I specify in
the
style take effect?
Thanks.
Nov 15 '05 #1
1 1292
Hi Tim
how the datagrid columns are generated ? -if AutoGenerateColumns is False
ok. If not, set it to false and define all the columns you have in html.
let the name of the columns match exactly the names of the columns in your
datasource.

· Write an ItemStyle element with each BoundColumn or TemplateColumns and
set the ItemStyle Width property in pixel (fixed).

· This however if the contents of any cell within that column exceed the
width given, browser will increase the column size automatically. To reduce
its chance you can also set ItemStyle-Wrap to be true.

· Unfortunately, whatever you do, there won't be 100% guarantee of browser
following the width you specify. To make sure though, you need to write
some script that would measure the number of consecutive characters within
a column cell and cut it with a space if it exceed your desired width.
hope that would help

Nov 15 '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...
3
by: bismarkjoe | last post by:
Hello, I am trying to set the widths on the columns of a DataGrid component, and I'm not sure if I'm doing it correctly. My code is below: //load some inital data table = db.GetDataTable(...
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...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
2
by: TB | last post by:
Hi All: I have this datagrid where space is very tight, and therefore I have to make sure that everything fits within a fixed screen width regardless of whether I am in list mode or in edit...
3
by: Mike Fellows | last post by:
Im trying to set the column width of individual datgrid columns I can set the column widths of all the columns at once using Me.DataGrid1.PreferredColumnWidth = 100 But I am unable to set the...
6
by: cr113 | last post by:
I'm trying to set the column widths for a datagrid. You'd think it would be easy. I looked it up in google and the first thing I found looked promising: datagrid1.columns(0).width = 2000...
1
by: kpg | last post by:
Hi All, me again. I've got my web form data grid set up pretty nice. But how do you set the column width? The columns seem to grow and shrink based on the width of the data in them (that's ok)...
4
by: Rich | last post by:
Hello, I have a one datagrid that will be based on different datatables. One datatable may have 7 columns, another 15... With the tables that have more columns, I have been manually dragging...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.