Dear Juno,
Thanks for your help!
The solution has worked in part.
As you can see, my links are placed by a Function named AddControls.
By using your solution only the last HyperLink placed receives img.width and
img.height.
Can you help me with the correction of the below code?
Public Class dynamic
Inherits System.Web.UI.P age
Dim myHyperLink As HyperLink
Dim img As New WebControls.Ima ge
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
AddControls(“ link1”,
“border-width:1px;borde r-style:Dotted;he ight:40px;width :128px;Z-INDEX: 103;
LEFT: 408px; POSITION: absolute; TOP: 208px”, “default.aspx ”)
AddControls(“ link2”,
“border-width:1px;borde r-style:Dotted;he ight:40px;width :128px;Z-INDEX: 103;
LEFT: 488px; POSITION: absolute; TOP: 208px”, “services.asp x”)
End Sub
Sub AddControls(ByV al ObjectName As String, ByVal Style As String, ByVal
NavigateUrl As String)
myHyperLink = New HyperLink
myHyperLink.ID = ObjectName
img.ImageUrl = "/corretoresdeseg uros/images/spacer.gif"
img.Width = Unit.Pixel(100)
img.Height = Unit.Pixel(100)
myHyperLink.Con trols.Add(img)
myHyperLink.Nav igateUrl = NavigateUrl
myHyperLink.Att ributes("style" ) = Style
PlaceHolder1.Co ntrols.Add(myHy perLink)
End Sub
End Class
"Juno" wrote:
Hi Robson ,
Try this:
Dim myHyperLink As HyperLink
myHyperLink = New HyperLink
myHyperLink.ID = "link1"
myHyperLink.Nav igateUrl = "default.as px"
myHyperLink.Att ributes("style" ) =
"style=bord er-width:1px;borde r-style:Dotted;he ight:40px;width :128px;Z-INDEX:
103; LEFT: 408px; POSITION: absolute; TOP: 208px"
Dim img As New WebControls.Ima ge
img.ImageUrl = "spacer.gif "
img.Width = Unit.Pixel(100)
img.Height = Unit.Pixel(100)
myHyperLink.Con trols.Add(img)
PlaceHolder1.Co ntrols.Add(myHy perLink)
--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET
"Robson Carvalho Machado" <Ro************ *******@discuss ions.microsoft. com>
wrote in message news:A8******** *************** ***********@mic rosoft.com... Dear friends,
I'm dynamically creating a Hyperlink with spacer.gif as ImageURL that is
an 1px transparent image only to determine link position, but as I create
this link dynamically I could not set image width. This problem makes my link
clickable only on its borders.
When viewing HTML source I could see that spacer.gif has no width and
height, so HTML shows only 1px x 1 px image.
What can I do to make all the area clickable?
CODEBEHIND
-----------------
Dim myHyperLink as HyperLink
myHyperLink = New HyperLink
myHyperLink.ID = "link1"
myHyperLink.Ima geUrl = "spacer.gif "
myHyperLink.Nav igateUrl = "default.as px"
myHyperLink.Att ributes("style" ) =
"style="bor der-width:1px;borde r-style:Dotted;he ight:40px;width :128px;Z-INDEX
: 103; LEFT: 408px; POSITION: absolute; TOP: 208px"
PlaceHolder1.Co ntrols.Add(myHy perLink)
HTML SOURCE GENERATED BY DYNAMIC LINK
--------------------------------------------------------
<a id="a_empresa" href="aempresa. aspx"
style="position :absolute;left: 415px;top:130px ;width:73px;hei ght:20px;"><img src="/corretoresdeseg uros/images/spacer.gif" border="0" /></a>