Column width

T

Tumurbaatar S.

How to retrieve _real_ width of DataGrid's column?
At design-time I set width of template columns with the following way:

<headerstyle width="80px"></headerstyle>

This sets the minimal width of the column and during run-time if the column
contains a long text, it can expand. I need to get an exact value of the
width,
at server or client side, and apply this width to another column.
I.e. what I want is 2 columns with same width.
 
A

Ahmed Fouad

Try setting CSS inline style="table-layout: fixed" and specify widths of
each column using <HeaderStyle/> element or as HeaderStyle-Width="...px"
attribute of each column in <Columns> collection. DONOT specify <ItemStyle
Width="...px"/> or ItemStyle-Width="...px" attribute.

When table-layout style attribute set to fixed, at client-side, IE will use
the FIRST row of datagrid (i.e the first row of html table) to set the
widths of each of its columns. If no more than one row specifies widths then
the table will appear as we want it to appear". Otherwise IE will ignore
explicit width values and revert to dynamic calculation of column widths.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top