Maybe a silly question, but you say that you donĀ“t get any data out after you have deleted and re-created the items, again, did you make sure that the field has some text on the page that you are visit? To me it could sounds that the field could be empty on that page.
I just ran into a similar issue today when working with some imported rich text. The problem for me was that the beginning of the string had lots of HTML comments and whitespace. I used HtmlAgilityPack to remove the comments and a regular expression to replace the repeated whitespace.
Try outputting the length of the string rather than the actual string to see if it does have a length of 50.
Umbraco.Truncate
Hi I have the following code:
@Umbraco.Truncate(@page.PortfolioItemBodyText, 50)
When i load my view that is meant to display this text it shows nothing.
If i put just:
@page.PortfolioItemBodyText
It displays the text that is available.
Why would this not work?
The code worked before, until i deleted the portfolio items and recreated them I have had issues.
But i can write the text to the page using @page.PortfolioItemBodyText no problem.
Kind regards.
Hi James,
What if you do it like this:
Hope this helps,
/Dennis
Still nothing :(
Heres the full code:
@foreach(var page in CurrentPage.DescendantsOrSelf(3).OrderBy("CreateDate desc").Take(4))
{
<div class="col-md-3 col-sm-6">
<div class="thumbnails thumbnail-style thumbnail-kenburn">
<div class="thumbnail-img">
<div class="overflow-hidden">
<img class="img-responsive" src="@page.PortfolioItemCoverPhoto" alt="" />
</div>
<a class="btn-more hover-effect" href="@page.Url">read more +</a>
</div>
<div class="caption">
<h3><a class="hover-effect" href="@page.Url">@page.PortfolioItemTitle</a></h3>
@Umbraco.Truncate(@page.PortfolioItemBodyText, 10)
</div>
</div>
</div>
}
Was working perfectly until i deleted all the portfolio items and added 2 new ones.
Hi James,
Maybe a silly question, but you say that you donĀ“t get any data out after you have deleted and re-created the items, again, did you make sure that the field has some text on the page that you are visit? To me it could sounds that the field could be empty on that page.
/Dennis
I can get data fine when i request it by doing:
@page.PortfolioItemBodyText
But if i try to truncate it it doesnt display anything
there is more than 100 characters of text
Regards.
I just ran into a similar issue today when working with some imported rich text. The problem for me was that the beginning of the string had lots of HTML comments and whitespace. I used HtmlAgilityPack to remove the comments and a regular expression to replace the repeated whitespace.
Try outputting the length of the string rather than the actual string to see if it does have a length of 50.
is working on a reply...