Click here to Skip to main content
15,908,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
I need to bind multiple lines of text from backend in repeater..
i have used this..
Text='<%#Limit(Eval("feedback_details"),40)%>'



C#
protected string Limit(object Desc, int length)
    {
    StringBuilder strDesc = new StringBuilder();
    strDesc.Insert(0, Desc.ToString());

    if (strDesc.Length > length)
    {
        return strDesc.ToString().Substring(0, length) + "...";
    }
    else return strDesc.ToString();
    }



it displays the text in same line like this
this is a sample.......

i want to implement like this
this is a sample paragraph.
this is a sample paragraph.
this is a....


like in google search..
it should display 3 to 4 lines from backend after that i have to use read more option


kindly help me..
Posted
Updated 18-Apr-14 3:05am
v2

1 solution

Insert line-break <br/> to "Desc" object in Limit() method on wherever you want to start a new line.
 
Share this answer
 
v2

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