Datagrid column width and truncating ...

  • Thread starter Thread starter Francois
  • Start date Start date
F

Francois

Hello,

How can I size my text to fit in a datagrid column ? I do not want the
datagrid go multiline.

I am using WEB Forms, not windows form, so CreateGraphics ans MesasureString
do not work.


Thanks.
 
Thanks a lot.

This has helped me to avoid multiline breaks. But now, the column is sized
to the longest text. I would like to size myself the column width, and the
text being clipped. I have tried overflow:hidden or owerflow-x:hidden, but
could not get it working. So I would like to cut the string in code (full
string displayed in the tootip). But I need to know the pixel lenght of the
string. iii not same size as mmm.

Francois.

Eliyahu Goldin said:
Try using css rule white-space: nowrap. It is also available on server
side as Wrap property in style parameters. You can also consider using
non-breaking spaces characters  .

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Francois said:
Hello,

How can I size my text to fit in a datagrid column ? I do not want the
datagrid go multiline.

I am using WEB Forms, not windows form, so CreateGraphics ans
MesasureString do not work.


Thanks.
 
It is difficult to be precise in pixels since you don't have control over
client browser settings. A better idea would be to compromise and to
truncate the strings to a fixed character length.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Francois said:
Thanks a lot.

This has helped me to avoid multiline breaks. But now, the column is sized
to the longest text. I would like to size myself the column width, and the
text being clipped. I have tried overflow:hidden or owerflow-x:hidden, but
could not get it working. So I would like to cut the string in code (full
string displayed in the tootip). But I need to know the pixel lenght of
the string. iii not same size as mmm.

Francois.

Eliyahu Goldin said:
Try using css rule white-space: nowrap. It is also available on server
side as Wrap property in style parameters. You can also consider using
non-breaking spaces characters  .

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Francois said:
Hello,

How can I size my text to fit in a datagrid column ? I do not want the
datagrid go multiline.

I am using WEB Forms, not windows form, so CreateGraphics ans
MesasureString do not work.


Thanks.
 
Back
Top