How to truncate retrieved records and provide link for full record

  • Thread starter Thread starter pauld
  • Start date Start date
P

pauld

Hello-
I'm sure this has been asked and answered before since it is a common
technique, but I can't seem to get the search terms needed to get me
an answer, so I thought I would post here.

I have a page that displays news and events when the page loads,
Sometimes the descriptions of these items are long enough that I would
like to have the description go on for, say, twenty-five words and
then have a "More" link where the complete item data can be displayed
on a new page.

Spinning off a new page from a a master is not a problem; what I am
trying to figure out is how to automatically due the truncating of the
description. Any help or direct link would be much appreciated. I am
working in VS2008/asp.net 2.0.

Thanks,
Paul
 
Hello pauld,

You can use the CSS to limit the text lenght with text-overflow: ellipse;,
but if you need to limit nubmer of rows just set the fixed number or rows
and then add "more.." manually

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


p> Hello-
p> I'm sure this has been asked and answered before since it is a common
p> technique, but I can't seem to get the search terms needed to get me
p> an answer, so I thought I would post here.
p> I have a page that displays news and events when the page loads,
p> Sometimes the descriptions of these items are long enough that I
p> would like to have the description go on for, say, twenty-five words
p> and then have a "More" link where the complete item data can be
p> displayed on a new page.
p>
p> Spinning off a new page from a a master is not a problem; what I am
p> trying to figure out is how to automatically due the truncating of
p> the description. Any help or direct link would be much appreciated. I
p> am working in VS2008/asp.net 2.0.
p>
p> Thanks,
p> Pau
 
Hello pauld,

You can use the CSS to limit the text lenght with text-overflow: ellipse;,
but if you need to limit nubmer of rows just set the fixed number or rows
and then add "more.." manually

Michael,
Thank you for taking the time to reply. I wonder if you could
elaborate on either of these methods...
If I am understanding text.overflow, it likely would not be
appropriate since it is based upon widths.

The row count is probably a more likely candidate, but the "add
manually" part is not ideal. I wonder if you could tell me how, for
example, Google groups is doing their truncation when you look at the
message list for any given group? This is exactly what I want to do. I
imagine it is either via word count or rows, with a [pseudocode]: if
rowcount>x, then add a link called "More" with a URL to a page that
is all of the text associated.

As I said, getting the page for a given item is not a problem; it is
the truncation code that will create the "More" link when the row
count exceeds x.

Thanks again and sorry if I am being dense,
Paul



---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog:http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

p> Hello-
p> I'm sure this has been asked and answered before since it is a common
p> technique, but I can't seem to get the search terms needed to get me
p> an answer, so I thought I would post here.
p> I have a page that displays news and events when the page loads,
p> Sometimes the descriptions of these items are long enough that I
p> would like to have the description go on for, say, twenty-five words
p> and then have a "More" link where the complete item data can be
p> displayed on a new page.
p>
p> Spinning off a new page from a a master is not a problem; what I am
p> trying to figure out is how to automatically due the truncating of
p> the description. Any help or direct link would be much appreciated. I
p> am working in VS2008/asp.net 2.0.
p>
p> Thanks,
p> Paul
 
Back
Top