Hai All,
use the Following code to limit your text accordingly
Change the "description" to your datafiled and Change the "40" to your desired limit of count to see it in a properway in the Gridview
Thanks
Today i came to face a situation in which is hould limit the text in a GridView in ASP.Net, C#, So i Just want to share it with you all For a help
use the Following code to limit your text accordingly
<asp:TemplateField HeaderText="Description" > <ItemTemplate> <asp:LinkButton ID="lnkBtnId" runat="server" Text='<%# ((string)Eval("description")).Length < 40? Eval("description") :((string)Eval("description")).Substring(0,40) + "..."%>' CommandName='<%# Eval("raw_id") %>' OnClick="lnkBtnId_Click"></asp:LinkButton> </ItemTemplate> </asp:TemplateField>
Change the "description" to your datafiled and Change the "40" to your desired limit of count to see it in a properway in the Gridview
Thanks
0 comments:
Post a Comment