Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I have a passage stored in sql database which i want to display using a label.But the label should display only first two or three lines of the passage.I have used this label inside listview control.Can anyone give me any idea on how to display a passage partially using c# or asp.net
Posted
Updated 9-Feb-14 21:23pm
v2
Comments
Kornfeld Eliyahu Peter 10-Feb-14 3:12am    
Have you done anything so far? Show some effort (code or searching)! As is it ain't a question...

1 solution

try this
you can define the size of the passage.
if the length of the passage exceeds the size it will remove the remaining text of the passage.

XML
<asp:ListView ID="listview" runat="server">
       <ItemTemplate>
           <asp:Label ID="lblPassage" Text='<%#   Eval("Passage").ToString().Length >200 ? Eval("Passage").ToString().Substring(0,200): Eval("Passage")   %>'
               runat="server"></asp:Label>
       </ItemTemplate>
   </asp:ListView>
 
Share this answer
 
Comments
faizel s 10-Feb-14 3:56am    
thanks karthik god bless you
Karthik_Mahalingam 10-Feb-14 4:02am    
if it helps, pls mark it as answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900