Links in user control

S

simon

I have application CPO.
I have user control with links which is included in all my pages.
But my pages are in different directories.

<TR>
<TD><%=funkcije.createUrl(path& "/advertisments.aspx",
"Advertisments",0)%></TD>
</TR>

Now I would like to set the path.
For example if the page is in the directory Admin then the link should be:

<TR>
<TD><%=funkcije.createUrl(./advertisments.aspx",
"Advertisments",0)%></TD>
</TR>

If the page is in default directory, the link should be:

<TR>
<TD><%=funkcije.createUrl(Admin/advertisments.aspx",
"Advertisments",0)%></TD>
</TR>

What about if the page is in other directory, for example User direcory?
How can I set the link to advertisments.aspx?
Set the absolute link?

<TR>

<TD><%=funkcije.createUrl("http://localhost/cpo/Admin/advertisments.aspx",
"Advertisments",0)%></TD>
</TR>

How can I solve this problem. No matter where my user control is, that I
have the right link?

My function is in other dll and definition is:

Function createUrl(ByVal link As String, ByVal name As String, Optional
ByVal stev As Int16 = 0, Optional ByVal cl As Int16 = 0, Optional ByVal
description As String = "") As String

Dim clas As String
If stev = 0 Then
clas = "class='main'"
ElseIf stev = 1 Then
clas = "class='clas1'"
End If

If cl = 0 Then
createUrl = "<a " & clas & " title='" & description & "' href="
& Chr(34) & link & Chr(34) & ">" & name & "</a>"
ElseIf cl = 1 Then
createUrl = "<a " & clas & " title='" & description & "' href="
& Chr(34) & "javascript:void(0)" & Chr(34) & " onclick=" &
Chr(34) & link & Chr(34) & ">" & name & "</a>"
else
createUrl = "<a " & clas & " title='" & description & "' href="
& Chr(34) & "javascript:" & link & Chr(34) & ">" & name &
"</a>"
End If

End Function

Thank you,
Simon
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top