Home » questions » I am using a text formatting control on asp.net page.?

I am using a text formatting control on asp.net page.?

2006-08-02 04:38:06, Category: Programming & Design
Actually i am storing this formatting text as HTML into a databse field of Text data type.now i am facing problem in display this text. i have to show all formatting text on another page. but if length of text is greater than 600 characters, then a link (more ) should be display , and when user clicks on link full html text will be display on page. but the problem is i can not simply use substring to cut the string, becase text is stored with Html tags for example user enters text="I am a man" then it will be stored as "

i am a man

", so if i want to display only 10 charcters then substring will return ="

i am a " , please help me

Answers

  1. Indian_Male

    On 2006-08-02 06:22:28


    You need to use two loops for this. Algorithm kind of solution is: Dim x as string dim r as int (r = ) dim i as int (loop counter) dim h as int (html tag counter) while i is not equal to r get a char from input string if it is a < char (starting HTML Tag) while h is not equal to length of string check the char found. If it is >, exit from the loop increment h end of inner while loop end if add the char to x get next char increment i while ends here Return x.