Datagrid column width and truncating ...

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.
 
F

Francois

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.
 
E

Eliyahu Goldin

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.
 

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

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,099
Latest member
AmbrosePri
Top