How to trim the text length from the description field if we

Posted by Community Admin on 04-Aug-2018 10:54

How to trim the text length from the description field if we have the image in the description?

All Replies

Posted by Community Admin on 15-Sep-2014 00:00

Hello there

 I want to trim the text length to 100 characters for the description I have used the code like 

<%# Eval("Content").ToString().Substring(0, 100)%> it is working fine and I am getting the result.

The problem is if we have the image and then content in the description field it is not showing any results, it is giving empty result.

How can i violate the image in the description and display only 100 characters of the text.

Thanks in advance.

Posted by Community Admin on 18-Sep-2014 00:00

Hi Venkata,

Actually this option will render the html but it is cut on character 100. So in case of any html tags in the content that is not closed - this will brake the html at all (for example: " some text <img src='/images/img1.j' ".

So I would recommend you to use a Summary field or create a custom filed of type Textbox where to place the summary as plain text and cut it at any character you need (as in your code).

Regards,
Svetoslav Manchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed