Positioning hyperlinks dynamicaly (in code)

C

carlos.cruz

Hi,

I trying to create dinamicaly hyperlinks, which I manage to do with the
following code:

Protected Overrides Sub OnPreRender(ByVal e As EventArgs)

ctl = New HyperLink
ctl.Target = "_blank"
ctl.ID = "hl"
ctl.Text = "Algeco.pt"
ctl.NavigateUrl = "http://www.algeco.pt"
Me.Controls.Add(ctl)

ctl = New HyperLink
ctl.Target = "_blank"
ctl.ID = "h2"
ctl.Text = "Solbinet.pt"
ctl.NavigateUrl = "http://www.solbinet.pt"
Me.Controls.Add(ctl)

MyBase.OnPreRender(e)
End Sub

The question is how can I set the position.

Thanks in advance

CC
 
S

Stanley

Try putting your links into a span tag:
Me.Controls.Add(New LiteralControl("<span style=""position:absolute;left:100;top:120;"">")
Me.Controls.Add(ctl)
Me.Controls.Add(New LiteralControl("</span>")

-Stanley

Hi,

I trying to create dinamicaly hyperlinks, which I manage to do with the following code:

Protected Overrides Sub OnPreRender(ByVal e As EventArgs)

ctl = New HyperLink
ctl.Target = "_blank"
ctl.ID = "hl"
ctl.Text = "Algeco.pt"
ctl.NavigateUrl = "http://www.algeco.pt"
Me.Controls.Add(ctl)

ctl = New HyperLink
ctl.Target = "_blank"
ctl.ID = "h2"
ctl.Text = "Solbinet.pt"
ctl.NavigateUrl = "http://www.solbinet.pt"
Me.Controls.Add(ctl)

MyBase.OnPreRender(e)
End Sub

The question is how can I set the position.

Thanks in advance

CC
 
N

nfedin

Put a Placeholder control on your ASPX or ASCX page. Place it where
you want the hyper links to be displayed. Then add the Hyperlink
controls to Placeholder.

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top