Links in user control

Discussion in 'ASP .Net' started by simon, May 12, 2004.

  1. simon

    simon Guest

    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
     
    simon, May 12, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=

    Response.Redirect() and absolute URL links and User Control questi

    =?Utf-8?B?QW5kcmUgUmFuaWVyaQ==?=, Feb 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    987
    Steve C. Orr [MVP, MCSD]
    Feb 4, 2005
  2. Mad Scientist Jr
    Replies:
    0
    Views:
    673
    Mad Scientist Jr
    Mar 22, 2006
  3. www.westerncartooncards.ca

    Exchange Links < Western Cartoon Cards > Exchange Links

    www.westerncartooncards.ca, Jul 12, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,287
    Toby Inkster
    Jul 12, 2004
  4. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    580
    Jonathan Wood
    Feb 2, 2010
  5. Garrett Smith
    Replies:
    14
    Views:
    338
    David Mark
    May 26, 2009
Loading...

Share This Page