Reputation: 15
I am using a label control in ItemTemplate tag in TemplateField tag in Gridview Control to show a field of data of my database . I want if a length of data is higher than 100 charachter the label control doens't show all of data.
<ItemTemplate>
<asp:Label ID="label4" runat="server" Text='<%# Bind("Description") %>' Width="200px" Font-Names="B Nazanin" EnableTheming="false" Height="24px" BorderStyle="Dashed"></asp:Label>
</ItemTemplate>
What should I do ?
Upvotes: 1
Views: 6552
Reputation: 460288
This is the simplest approach:
Text='<%# Eval("Description").ToString().Substring(0, 100) %>'
Upvotes: 2