I have a problem with extending the HtmlHelper class to render an image tag
I just wrote this code
namespace Mace_CrmSystem
{
public static class ExtendedHelper
{
public static TagBuilder HaidarImage(this HtmlHelper instance, string src) {
TagBuilder inst = new TagBuilder("img");
inst.MergeAttribute("src", src);
return inst;
}
}
}
and in the index view I wrote this code
@Html.HaidarImage("http://haidar.ws/wp-content/uploads/2014/07/ipaduse.jpg");
but the problem is that when the view render the tag , it does not render it as an Hrml tag, rather it renders it as a normal text so the result be like this
<img src="http://haidar.ws/wp-content/uploads/2014/07/ipaduse.jpg"></img>;
another problem is that I tried to add the namespace inside the web.config page to be available over all the page but the intellisense does not show the extended method until I explicitly declare it at the view page itself.
so please could anyone help me to solve my problem.