By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,510 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

Links in user control

P: n/a
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
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.