How to trim the text length from the description field if we have the image in the description?
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.
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