Hello
anybody knows how i can strip out the html from a control's innerhtml to show only the relevant text? i.e
<span id="test1" runat="server"><a href="http://links.10026.com/?link=test1.htm">abcde</a><b>blah</b></span
so that on my server side code, somehow i would get "abcde blah"?
thanks!FYI... you wouldn't get "abcde blah" you'd get "abcdeblah"
I dont think there is an auto-way to do this but just look for the > and <
and use the Substring in a recursive function
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"newbie" <anonymous@.discussions.microsoft.com> wrote in message
news:799A9C64-BAB4-45D1-80EC-580EA1E98D3F@.microsoft.com...
> Hello,
> anybody knows how i can strip out the html from a control's innerhtml to
show only the relevant text? i.e.
> <span id="test1" runat="server"><a
href="test1.htm">abcde</a><b>blah</b></span>
> so that on my server side code, somehow i would get "abcde blah"??
> thanks!
"newbie" <anonymous@.discussions.microsoft.com> wrote in message
news:799A9C64-BAB4-45D1-80EC-580EA1E98D3F@.microsoft.com...
> Hello,
> anybody knows how i can strip out the html from a control's innerhtml to
show only the relevant text? i.e.
> <span id="test1" runat="server"><a
href="test1.htm">abcde</a><b>blah</b></span>
> so that on my server side code, somehow i would get "abcde blah"??
> thanks!
Provided it is xhtml compliant (i.e. no unclosed tags and case sensitive),
why not read the contents of each node, with an XmlTextReader? Then
concatenate each node's value using a StringBuilder.
ms-help://MS.NETFrameworkSDK/cpref/html/frlrfSystemXmlXmlTextReaderClassctor
Topic.htm
...and see the example at bottom for how to use the XmlTextReader.
R.
0 comments:
Post a Comment