How to adjust column width at runtime

I want to know how to adjust column width at runtime, the column width should change depending on the max length of the coloumn data in all rows.
angireddyAsked:
Who is Participating?
 
bramsquadCommented:
the column width can only be one size.  

if you are asking whether or not each CELL has its own size depending on the data within it.....i highly doubt it, and ive never seen or heard of that done.  

>>"Like the first column be "Thomas" and the next be "He works at IBM", in this example the datagrid column width for 2nd >>column will be more than the 1st. Please let me know if this is possible."

im having trouble understanding this....do you mean column or row within a column?

either way, i dont think its possible to adjust the width of every cell in a  datagrid.....and even if you could, aestetically speaking, that would be pretty unorganized and messy looking way to represent data

~b

0
 
bramsquadCommented:
this site should fully answer your question

http://support.microsoft.com/default.aspx?scid=kb;en-us;812422&sd=tech#6

~b
0
 
angireddyAuthor Commented:
But looks like, that algorithm will set all the columns to max, that could waste my other column area.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
bramsquadCommented:
this makes the column field the maximum they ahve to be to still view the data....like if you were to double click between columns in access or excel.

and sorry heres a vb one

http://support.microsoft.com/default.aspx?scid=kb;en-us;811203

0
 
angireddyAuthor Commented:
Can we do that at runtime, depending on the text length, the size of the column should change
0
 
angireddyAuthor Commented:
Please let me know how we can adjust the datagrid column width according to the text
0
 
bramsquadCommented:
i suggest you revisit the website.
0
 
angireddyAuthor Commented:
In the website, ther are setting the longest column element to the datagrid, that means all the columns width will be adjusted to the longest column size. So, its waste of space and the grid view is going out of screen. Please let me know if we can adjust the column width depending on the data. Like the first column be "Thomas" and the next be "He works at IBM", in this example the datagrid column width for 2nd column will be more than the 1st. Please let me know if this is possible.

Reddy
0
 
angireddyAuthor Commented:
Thank you, that's all I wanted to know, if its possible or not.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.