954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

generate anchor tag dynamically in code behind

Hi,

I want to generate an anchor tag

close

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

sniigg
Light Poster
31 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

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";
        this.form1.Controls.Add(htmlanchor);
    }
Renukavani
Junior Poster
123 posts since Jul 2008
Reputation Points: 10
Solved Threads: 23
 

Thanks Renu

sniigg
Light Poster
31 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

And how do you associate it with an image?

CaptLiberty
Newbie Poster
1 post since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: