ASP.NET - how to embed image in hyperlink - Asked By mani on 24-Jan-12 12:08 AM

hi..i have text in my editor controll..and i want to make that text as hyperlink and need to embed image into that hyperlink when uploading images....
 like  embeding url in hyperlink.....
after posting that text..i need to display that embeded  image on mouseover  on that hyperlink???can anyone help???if its not clear i will explain in detail//...
D Company replied to mani on 24-Jan-12 12:17 AM
Hello Friend you can do like this,



string text = "some message"; 
string augmentedText = text.Replace("provide", "<a href='#provide'>provide</a>");
 


You could also use regular expressions to accomplish this.

Here's a sample that converts each word to upper case:

public static string MatchEval(Match m) 
{ 
   
return m.ToString().ToUpper(); 
} 
 
static void Main(string[] args) 
{ 
   
string text = "This is some sample text."; 
 
   
Console.WriteLine(text); 
 
   
string result = Regex.Replace(text, @"\w+", new MatchEvaluator(MatchEval)); 
 
   
Console.WriteLine(result); 
} 




Regards
D
smr replied to mani on 24-Jan-12 12:27 AM
hi

you can do in this way

<a  href src="image source here" alt="xxx">Your text here</a>
Devil Scorpio replied to mani on 24-Jan-12 08:38 AM
Hi,

I dont now whether it will work in ur case. Its working finre in PHP. U need to follow this logic. Lets hope for the best.

<html> 
<head> 
<title>Image Hover</title> 
<script type="text/javascript"> 
function Show_Image(IDS) { 
  document.getElementById(IDS).style.display = "block"; 

function Hide_Image(IDS) { 
  document.getElementById(IDS).style.display = "none"; 

</script> 
</head> 
<body> 
<a href="javascript:alert('Link to somewhere.')" 
onMouseOver=Show_Image('Img1') onMouseOut="Hide_Image('Img1')">Link with image</a> 
<span id="Img1" style="display:none"> 
<img src="ImageSourcePathAndFile" alt="Image information" /></span> 
</body> 
</html>