Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change datagrid column size

Status
Not open for further replies.

jsnunez

MIS
Feb 4, 2004
72
0
0
US
Hi all,

I created a datagrid with autocolumnsize = yes. I am not defining the columns in design mode; but attaching a table frm a datasource. this means that the:
- itemStyle-Wrap="True"
is a default value and the text in some cells appears wrapped in several lines. I would like it to show the text in only one line per cell. By default the size of the whole column is the size of the header or title.

Questions:
How can I change the size of a datagrid column to be the same as the size of the content, not the size of the header.

is there a way in runtime to add something like itemStyle-Wrap="False", on each column?

thanks
Jsn
 
Jsn - I came across another article which sets Wrap="false" during the OnItemDataBound event here. Might have an insight into what you are trying to do.
 
Hi

I foud this code as an example but it does not work because my datagrid columns are not created in desing mode, they are created when the data is bound.


When it calls the function AdjustTextForDisplay(string text, int colIndex, DataGrid grid), the variable grid is empty. I do not know if I can replace it by a dataview or a dataset table.

thanks
jsn
 
jsn - have you tried researching into using the ItemDataBound event? Seems like that might be an angle on this problem (inserting the css conditions here). Just a thought; let us know how you're coming along with this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top