Im using a repeater control and a databinder to display data from the database to my website.
example: DataBinder.Eval(Container, “DataItem.title”)
Sometimes the text is too long
Normally I use substring to display the preferred string in length.
But How do I do this with the databinder
And if the text is too long (> 20 characters) I want to truncate it and leave three dots behind.
How to do that ?
I’d suggest an extension method to do the heavy lifting, in order to make the markup as simple as possible:
Then use it in markup as: