Hi i want to know how to get first 25 characters from Long string value. Example i have string value like
“Clamp-on Injection probe Instrumentation” now i want to get the first 25 characters from this string.And also i want to show the whole string value in Tool Tip.
My code
string val1 ="Clamp-on Injection probe Instrumentation"
string val2 =val1.Substring(25, Math.Min(val1 .Length, maxLength));
I have tried the above code.And correct my code if i am wrong and also tell me how to show the whole string value in tool tip .Kindly any one help me resolve this issue.Thanks.
2
Answers
Below code should get you first 25 characters of string :
In your html:
I think using just CSS would do it, try building a html like this:
And add this kind of CSS:
This would make the text that doesn’t fit within 50px to be hidden using ellipsis
...
, and will show the full tooltip since thetitle
contains the full text.Hope it helps.