I am adding a dynamic column to an ASP.NET grid view.
Code to add the dynamic column:
List<DataControlField> columns; // this contains all gridview columns.
BoundField boundField = new BoundField();
boundField.DataField = long_text_column.SortExpression;
boundField.SortExpression = long_text_column.SortExpression;
columns.Insert(0, boundField);
How can I trim / truncate long_text_column
to show only first 15 characters on the UI.
NOTE: I do not want to trim at the database level for other reasons.
I would add an extra property to the class with only a
get
that returnslong_text_column
with a max length of 15.