Start New Discussion within our Web Development Community


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";

how to add Onclick in ancher tag in html


Dynamically add the Ancher Tag in means codebehind to add anchor tag in

This question has already been answered. Start a new discussion instead.