开发者

Label control in ItemTemplate tag in TemplateField tag in Gridview control

开发者 https://www.devze.com 2023-02-04 02:34 出处:网络
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 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) %>'
0

精彩评论

暂无评论...
验证码 换一张
取 消