I am trying to get the first 50 letters, so I used the subString function to get it.
As you can see, I used this code to get it:
<%# Eval("BannerDescription").ToString.Substring(1, 50)%>
But, unfortunately, it does not work and an error message appears:
The index and length must refer to the location within the string.
So is there any other way to fix it?
since the user controls the data entry! several times he was going to enter 10 letters at another time, maybe 1000 letters, so how can I solve this?
I tried them all, but we can use it like this:
<%# IIf(Eval("BannerDescription").ToString().Length > 49, Eval("BannerDescription").ToString().Substring(0, 49), Eval("BannerDescription"))%>
Thanks.
Hajjaj
source share