Click here to Skip to main content
13,197,200 members (57,844 online)
Rate this:
Please Sign up or sign in to vote.
HI every one.

In my Project I need To Assign String value to a anchor tag ...

For Each String value i need to Dynamically create a New Anchor Tag in cs file ..

can anyone help me pls
Posted 16-Nov-12 18:49pm
Updated 17-Nov-12 1:00am
Krunal R 17-Nov-12 2:07am
what have you tried so far ?
Hari Chandra Prasad Ravuri 17-Nov-12 2:08am
hi bro till now i tried this but it didnt work
int i = 1;
Fileattach = At;
if (Fileattach != "")
HtmlAnchor HA = new HtmlAnchor();
HA.Visible = true;
HA.ID = "ID" + i.ToString();
HA.Attributes.Add("runat", "server");
HA.InnerHtml = Fileattach.ToString();
HA.HRef = "./Download.aspx?File=" + Fileattach;
n.podbielski 17-Nov-12 6:34am
Please edit your question to be more clear. For now I read this 3 times and still don't get it.
Hari Chandra Prasad Ravuri 17-Nov-12 7:01am
check now i have edited my question
Pro Idiot 18-Nov-12 1:59am
Posted a solution , Do check

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add a div in your aspx , in which you want to add all your anchor tags

<div id="divTest" runat="server"></div>

Code , to add an anchor Tag to the Div

HtmlAnchor htmlAnchor = new HtmlAnchor();
          htmlAnchor.HRef = "";
          htmlAnchor.InnerText = "Click";
Hari Chandra Prasad Ravuri 18-Nov-12 23:41pm
Thanks Deepak i will try it
Pro Idiot 19-Nov-12 11:24am
If it helped, please mark as answer :)
Hari Chandra Prasad Ravuri 20-Nov-12 0:00am
Once again thanks depaak it worked for me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 17 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100