Remove html tags from ahref title tag

I have an asp.net app with the following markup in the code snippet below.

Works great but how can I remove the html tags from the ahref title tag?

The title tag is the href tooltip so when you hover over the link it displays the contents of "AnglerBio" but as this was inputted via rich text editor I get all the markup as well.  I just want the text
<a href="AnglerBio.aspx?bioId=<%#Eval("bId")%>" title="<%#Eval("AnglerBio")%>">
                                    <%#Eval("AnglerBio")%></a>

Open in new window

mugseyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

OMC2000Commented:

add the following javascript to your page and call removeHTMLTags for AnglerBio content

http://javascript.internet.com/snippets/remove-html-tags.html

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Robert Nyman | http://robertnyman.com/ */
function removeHTMLTags(){
       if(document.getElementById && document.getElementById("input-code")){
             var strInputCode = document.getElementById("input-code").innerHTML;
             /*
                    This line is optional, it replaces escaped brackets with real ones,
                    i.e. < is replaced with < and > is replaced with >
             */      
              strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
                    return (p1 == "lt")? "<" : ">";
             });
             var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
             alert("Output text:\n" + strTagStrippedText);      
   // Use the alert below if you want to show the input and the output text
   //            alert("Input code:\n" + strInputCode + "\n\nOutput text:\n" + strTagStrippedText);      
       }      
}
0
mugseyAuthor Commented:
Could you give me an example of how to call the javascript please using my code snippet
0
mugseyAuthor Commented:
Infact I am using asp.net and the tooltip works fine when I run the app locally using cassini - its when I deploy onto dev server using IIS that the markup id displayed
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Akin DeluI’m a software engineer, tech enthusiast and UI/UX lover. Commented:
Is you a anchor in a grid?
0
OMC2000Commented:


It was not a good idea with javascript

use .net function

public static string StripHtml(string html, bool allowHarmlessTags)
{
   if (html == null || html == string.Empty)
     return string.Empty;

   if (allowHarmlessTags)
     return System.Text.RegularExpressions.Regex.Replace(html, "", string.Empty);

   return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", string.Empty);
}

...

<a href="AnglerBio.aspx?bioId=<%#Eval("bId")%>"
title="<%#this.StripHTML(Eval("AnglerBio"), false) %>">
                                    <%#Eval("AnglerBio")%></a>

# this.GetItemUrl( Eval("sku") as string )
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mugseyAuthor Commented:
OK thanks

Yes I think the .net option is better but would this strip out ALL html tags?

Thanks
0
OMC2000Commented:

actually it must remove all XML tags, i.e. everything between "<" and ">"

0
mugseyAuthor Commented:
OK thanks

but I get compiler error


StripHtm(string, bool)' has some invalid arguments

this is markup

title="<%#this.StripHtm(Eval("Body"), false) %>">
0
mugseyAuthor Commented:
Infact I got the error to remove when I took out the "this" keyword
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.