I Am Using A Text Formatting Control On Asp.Net Page.?
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 "<p>i am a man</p>", so if i want to display only 10 charcters then substring will return ="<p>i am a " , please help me
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 "<p>i am a man</p>", so if i want to display only 10 charcters then substring will return ="<p>i am a " , please help me
You need to use two loops for this. Algorithm kind of solution is:
Dim x as string
dim r as int (r = <number of chars you want to extract>)
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.
Dim x as string
dim r as int (r = <number of chars you want to extract>)
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.
You need to use two loops for this. Algorithm kind of solution is:
Dim x as string
dim r as int (r = <number of chars you want to extract>)
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.
Dim x as string
dim r as int (r = <number of chars you want to extract>)
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.