473,804 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid column width and truncating ...

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.
Jan 9 '08 #1
3 2060
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@coreb ridgecomwrote in message
news:u3******** ******@TK2MSFTN GP06.phx.gbl...
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.

Jan 9 '08 #2
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" <RE************ **************@ mMvVpPsS.orga écrit dans le
message de news: eS************* ***@TK2MSFTNGP0 2.phx.gbl...
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@coreb ridgecomwrote in message
news:u3******** ******@TK2MSFTN GP06.phx.gbl...
>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
MesasureStri ng do not work.
Thanks.


Jan 9 '08 #3
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@coreb ridgecomwrote in message
news:er******** ******@TK2MSFTN GP03.phx.gbl...
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" <RE************ **************@ mMvVpPsS.orga écrit dans
le message de news: eS************* ***@TK2MSFTNGP0 2.phx.gbl...
>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@coreb ridgecomwrote in message
news:u3******* *******@TK2MSFT NGP06.phx.gbl.. .
>>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
MesasureStrin g do not work.
Thanks.



Jan 9 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3946
by: web1110 | last post by:
Hi y'all, I have resized the columns in a DataGrid and I want to set the width of the DataGrid to fit the columns. Just summing the column widths is too short due to the grid and gray row selection column on the left. I have the widths of the columns. What other values do I need to include in the DataGrid width? Thanx,
3
4268
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint of a subclassed DataGridTextBoxColum dos not seem like a practical way to do it. I have subclassed a DataGrid and overridden the OnPaint as such:
5
3516
by: Brian Henry | last post by:
I have a messaging application that has a data grid with information like an email list would have (from, subject, time sent, size) but the subject could be very long in theory, and then it would word wrap.. the subject is a variable width column (resizes to fit space) while the others are fixed size... the problem is that i dont want the text to ever word wrap.. but truncate the visible subject to match the current cell width... (kinda...
2
6416
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
9
1542
by: Sean | last post by:
I am using a datagrid to display some data. I notice when I click in a cell where the data is longer than the cell width, it truncates the end of the data off. For example: The data is: This is sample data Column only has room for:
6
2751
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is freeze.
2
10408
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat actually happens is... when the Text size is too big... the column
2
1781
by: cj | last post by:
I was looking over some of my 2003 code today (see below) that loads a foxpro table via oledb connection. I used a sub "autosizecolumns" I found on the web but I never quite understood why they said the style name had to be the same as the table name. Perhaps the are refering to ts1.mappingname must be the same as the table name (datagrid1.datamember) because I've read that that is how the datagrid associates a style with what it's...
2
6600
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.