1,105,281 Community Members

generate anchor tag dynamically in code behind

Member Avatar
sniigg
Light Poster
31 posts since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,

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....

Member Avatar
Renukavani
Junior Poster
123 posts since Jul 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 23 [?]
Skill Endorsements: 0 [?]
 
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);
    }
Member Avatar
sniigg
Light Poster
31 posts since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks Renu

Question Answered as of 4 Years Ago by Renukavani
Member Avatar
CaptLiberty
Newbie Poster
1 post since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

And how do you associate it with an image?

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: