Question : Gridview-only show first 10 characters of text.

I have gridview which displays text from a database. Sometimes the text is very long, therefore I would like to only display the first 10 characters of text followed by some dots.

For example instead of having sdsadsadasdsadasdsaasdasdsadsadsa sadasdasdas i coul have aswredsawq.....

Answer : Gridview-only show first 10 characters of text.

what about doing that in the query itself?
what is the database?

in ms sql server:

1:
2:
3:
SELECT CASE WHEN LEN(yourfield) > 10 THEN SUBSTRING(yourfield, 1,10) + '...' ELSE yourfield END yourfield_short
  FROM yourtable
 WHERE ...
Random Solutions  
 
programming4us programming4us