I have a varchar field full of text and I want to be able to just show a 100 character snippet of the text, and show a "Read More..." link at the end of the snippet. When the user clicks "Read More..." I would like the page to expand and display the rest of the text.
I guess the 'show/hide' featured could be done with jQuery but i wasn't sure if ASP had some function to effectively split the varchar field of text in two?
My content is currently being pulled into the page using;
<%=StripHTML(rspropertyresults.Fields.Item("ContentDetails").Value)%>
Which uses this function to strip out any HTML tags;
<%
Function stripHTML(strHTML)
''Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|\n)+?>"
''Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
''Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput ''Return the value of strOutput
Set objRegExp = Nothing
End Function
%>