473,513 Members | 7,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text overflow ==> "..."

Anyone know of a way, or a control, which would allow me to clip text with a
"..." displayed at the end?

We have a product comparison page, with products lied up side by side... one
of the fields displayed is the manufacturer, and some of them have VERY long
names, so id like to when the name is long, convert it from "Mr Joe Shmoes
Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of having
it crunch all the other products to the side.

Thanks in advance,
- Eidolon.
Nov 18 '05 #1
6 1410
What database are you using? This can be done directly in your SQL or Stored
Procedure.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Eidolon" <ei**************@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Anyone know of a way, or a control, which would allow me to clip text with a "..." displayed at the end?

We have a product comparison page, with products lied up side by side... one of the fields displayed is the manufacturer, and some of them have VERY long names, so id like to when the name is long, convert it from "Mr Joe Shmoes
Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of having it crunch all the other products to the side.

Thanks in advance,
- Eidolon.

Nov 18 '05 #2
This is an ASP example but the same principle/idea will work
http://www.darkfalz.com/1076/

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Eidolon" <ei**************@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Anyone know of a way, or a control, which would allow me to clip text with a "..." displayed at the end?

We have a product comparison page, with products lied up side by side... one of the fields displayed is the manufacturer, and some of them have VERY long names, so id like to when the name is long, convert it from "Mr Joe Shmoes
Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of having it crunch all the other products to the side.

Thanks in advance,
- Eidolon.

Nov 18 '05 #3
One idea is to test for length, as such and take a subset of the string.

string longname;

if(longname.Length > 300)
{
longname = longname.Substring(0,299);
}

"Eidolon" <ei**************@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Anyone know of a way, or a control, which would allow me to clip text with a "..." displayed at the end?

We have a product comparison page, with products lied up side by side... one of the fields displayed is the manufacturer, and some of them have VERY long names, so id like to when the name is long, convert it from "Mr Joe Shmoes
Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of having it crunch all the other products to the side.

Thanks in advance,
- Eidolon.

Nov 18 '05 #4
If Len(theString) > 10 then
theString = Left(10, theString) & "..."
End If
"Eidolon" <ei**************@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Anyone know of a way, or a control, which would allow me to clip text with a "..." displayed at the end?

We have a product comparison page, with products lied up side by side... one of the fields displayed is the manufacturer, and some of them have VERY long names, so id like to when the name is long, convert it from "Mr Joe Shmoes
Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of having it crunch all the other products to the side.

Thanks in advance,
- Eidolon.

Nov 18 '05 #5
Thank you to everyone who has answered thus far. None of these solutions are
quite what i meant though.

In the Windows API, there is this function PathCompactPath, defined in
SHLWAPI.dll, where you can pass in the pixel width you need a path to fit
in, and it will shorten it as it needs to to fit in the desired length.

I am looking for something similar. I have a table with a variable number of
columns, each column representing a product. The first row in each column is
the manufacturers name. i want all the columns to be the same width across
the page, so i set them in code each to
<code>width='<%=Floor(100/NumCols)%>%'.
When i get one of these really long names though, it blows that column's
width way up, and crowds the other ones off to the side. I want to be able
to have the mfg name be dynamically truncated to fit in the specified column
width (probably in pixels?). Now i think of it, this would likely be more a
client-side scripting thing.

Any ideas, or solutions, appreciated.
Thanks in advance,
- Aaron.
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
If Len(theString) > 10 then
theString = Left(10, theString) & "..."
End If
"Eidolon" <ei**************@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Anyone know of a way, or a control, which would allow me to clip text with
a
"..." displayed at the end?

We have a product comparison page, with products lied up side by side...

one
of the fields displayed is the manufacturer, and some of them have VERY

long
names, so id like to when the name is long, convert it from "Mr Joe

Shmoes Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of

having
it crunch all the other products to the side.

Thanks in advance,
- Eidolon.


Nov 18 '05 #6
A possibility:
In the graphics namespace, there is a MeasureString method, that you can use
to
get the pixel-length of a string (using a specific font).
You could measure your name. If it shorter than you want to allow, no
problem,
else shorten the name until it fits.

Hans Kesting

"Eidolon" <ei**************@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Thank you to everyone who has answered thus far. None of these solutions are quite what i meant though.

In the Windows API, there is this function PathCompactPath, defined in
SHLWAPI.dll, where you can pass in the pixel width you need a path to fit
in, and it will shorten it as it needs to to fit in the desired length.

I am looking for something similar. I have a table with a variable number of columns, each column representing a product. The first row in each column is the manufacturers name. i want all the columns to be the same width across
the page, so i set them in code each to
<code>width='<%=Floor(100/NumCols)%>%'.
When i get one of these really long names though, it blows that column's
width way up, and crowds the other ones off to the side. I want to be able
to have the mfg name be dynamically truncated to fit in the specified column width (probably in pixels?). Now i think of it, this would likely be more a client-side scripting thing.

Any ideas, or solutions, appreciated.
Thanks in advance,
- Aaron.
"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:uR****************@TK2MSFTNGP09.phx.gbl...
If Len(theString) > 10 then
theString = Left(10, theString) & "..."
End If
"Eidolon" <ei**************@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Anyone know of a way, or a control, which would allow me to clip text with
a
"..." displayed at the end?

We have a product comparison page, with products lied up side by
side... one
of the fields displayed is the manufacturer, and some of them have
VERY long
names, so id like to when the name is long, convert it from "Mr Joe

Shmoes Super Duper Electronics Builder" to "Mr Joe Shmoes Sup..." instead of

having
it crunch all the other products to the side.

Thanks in advance,
- Eidolon.



Nov 18 '05 #7

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

Similar topics

3
3764
by: Derek Fountain | last post by:
Just asked a question regarding this little bit of XSL: --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> ...
1
6158
by: tilt | last post by:
Hello, I use an object element to replace the iframe element in ie, like this: <object id="x_obj" data="http://.../" type="text/html"> <iframe name="x_if" id="x_if"...
1
6046
by: rynato | last post by:
I have a <spanof width X px and height Y px. I want to read the text of an article, which is stored in a mySQL table, and pass to that <spanonly just enough text to fit in it, along with a 'read...
15
11565
by: removeps-groups | last post by:
How to wrap text in <ptag if the text has no spaces and is very long? Here is an example: ...
2
7043
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so...
3
7801
by: joe | last post by:
Is it OK to have multiple: <script type="text/javascript" src="funcs1.js"></script> <script type="text/javascript" src="funcs2.js"></script> <script type="text/javascript"...
0
1293
by: robert112 | last post by:
Hi All, I have a .net WSE 3.0 Web Service acting as a client calling a j2EE web Service. The service works when I call it using a client program called soapUI (which is free to download) but when...
9
3056
by: Stan Brown | last post by:
I've searched Google and the group archives, and came up empty, but maybe I just haven't selected the right search term. This concerns only the screen -- printing isn't an issue. I'm also not...
3
3580
by: Jason7899 | last post by:
Hello Everyone, I have been searching tirelessly and cannot find a way to convert this text into html text= &amp;lt;p&amp;gt;LONDRES (Reuters) - Cientistas descobriram tr&amp;ecirc;s importantes...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5677
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,...
1
5079
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...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
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 ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.