PC Review


Reply
Thread Tools Rate Thread

Datagrid column width and truncating ...

 
 
Francois
Guest
Posts: n/a
 
      9th Jan 2008
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.


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      9th Jan 2008
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" <francois@corebridgecom> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Francois
Guest
Posts: n/a
 
      9th Jan 2008
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" <(E-Mail Removed)> a écrit dans le
message de news: eS%(E-Mail Removed)...
> 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 &nbsp;.
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Francois" <francois@corebridgecom> wrote in message
> news:(E-Mail Removed)...
>> 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.
>>

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      9th Jan 2008
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" <francois@corebridgecom> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> a écrit dans
> le message de news: eS%(E-Mail Removed)...
>> 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 &nbsp;.
>>
>> --
>> Eliyahu Goldin,
>> Software Developer
>> Microsoft MVP [ASP.NET]
>> http://msmvps.com/blogs/egoldin
>> http://usableasp.net
>>
>>
>> "Francois" <francois@corebridgecom> wrote in message
>> news:(E-Mail Removed)...
>>> 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.
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting Column width of Template Column in Datagrid.. Charleees Microsoft ASP .NET 2 20th Jun 2006 01:52 PM
help(F1)(F1) datagrid column width =?Utf-8?B?SXNtYWlsIEF3YWRhdA==?= Microsoft Dot NET Framework Forms 2 16th Aug 2004 08:55 AM
Datagrid Column Width =?Utf-8?B?SGVpbnogRGV1Ymxlcg==?= Microsoft ADO .NET 1 20th Feb 2004 10:13 AM
DataGrid Column Width Randy Microsoft C# .NET 0 28th Jul 2003 07:34 PM
Re: datagrid column width BenoitM Microsoft C# .NET 0 24th Jul 2003 10:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:58 AM.