Label control in ItemTemplate tag in TemplateField tag in Gridview control
I am using a label control in ItemTem开发者_Go百科plate 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 ?
This is the simplest approach:
Text='<%# Eval("Description").ToString().Substring(0, 100) %>'
精彩评论