I want to generate an anchor tag

<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>

in code behind using c#...but dunno how to do....

Add the namespace for HtmlAnchor (using System.Web.UI.HtmlControls;),

protected void Page_Load(object sender, EventArgs e)
        HtmlAnchor htmlanchor = new HtmlAnchor();
        htmlanchor.HRef = "#";
        htmlanchor.Title = "Welcome"; //tooltip
        htmlanchor.InnerText = "Welcome";

And how do you associate it with an image?

how to add Onclick in ancher tag in html


Dynamically add the Ancher Tag in asp.net means codebehind to add anchor tag in asp.net

how to add Onclick in ancher tag in html

htmlanchor.Attributes["onClick"] = "myOnClick();";