Reputation: 71
I have a Radgrid with a column Product Description. The product description is very long and it obscures the view for the user.
Please see attached picture
Radgrid Product Description View: https://i.sstatic.net/uvi2X.jpg
How can I hide portion of the text where a see more content extends the hidden text.
Upvotes: 0
Views: 862
Reputation: 71
The solution is as the follows:
Designer View:
<telerik:GridTemplateColumn DataField="Product_Description" HeaderText="Product Description" UniqueName="Product_Description">
<ItemTemplate>
<asp:Label ID="Product_DescriptionLabel" runat="server" Text='<%# TrimDescription(Eval("Product_Description") as string) %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
Code View:
protected string TrimDescription(string description) { if (!string.IsNullOrEmpty(description) && description.Length > 200) { return string.Concat(description.Substring(0, 200), "..."); } return description; }
The page is only used to view a summary of the requested tables.
See screenshot:
Upvotes: 1