place c# inside aspx

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coder Coder

    place c# inside aspx

    Hi,

    I have to set the url of a link from the codebehind.

    I want to call the GetLink function which returns a string.

    <<a href= <<% GetLink(); %>>My Link<</a>>

    - Thanks,
  • Juan Gabriel Del Cid

    #2
    Re: place c# inside aspx

    > Hi,[color=blue]
    > I have to set the url of a link from the codebehind.
    > I want to call the GetLink function which returns a string.
    > <<a href= <<% GetLink(); %>>My Link<</a>>
    >
    > - Thanks,[/color]

    Well, if you want to do it in the .aspx file, it goes like this:

    <a href="<%= GetLink() %>">Click here</a>

    And GetLing() is a function that returns the link (it can be declared and
    implemented in the .aspx.cs file or in the .aspx file, wherever you want).

    Now, if you want to, you could use a HyperLink control and set it's
    NavigateUrl property in the .aspx.cs file:

    private HyperLink myLink;

    public void Load(...) {
    :
    :
    // set the URL
    myLink.Navigate Url = "/downloads/traci.mpg";
    }

    I hope that helps,
    -JG


    Comment

    • Chris LaJoie

      #3
      Re: place c# inside aspx

      I believe this is what you're looking for:

      <<a href= <<% Response.Write( GetLink()); %>>My Link<</a>>

      Chris

      "Coder Coder" <coder5811@yaho o.com> wrote in message
      news:f547ce3b.0 310021413.d4b8b 83@posting.goog le.com...[color=blue]
      > Hi,
      >
      > I have to set the url of a link from the codebehind.
      >
      > I want to call the GetLink function which returns a string.
      >
      > <<a href= <<% GetLink(); %>>My Link<</a>>
      >
      > - Thanks,[/color]


      Comment

      • Chris LaJoie

        #4
        Re: place c# inside aspx

        I believe this is what you're looking for:

        <<a href= <<% Response.Write( GetLink()); %>>My Link<</a>>

        Chris

        "Coder Coder" <coder5811@yaho o.com> wrote in message
        news:f547ce3b.0 310021413.d4b8b 83@posting.goog le.com...[color=blue]
        > Hi,
        >
        > I have to set the url of a link from the codebehind.
        >
        > I want to call the GetLink function which returns a string.
        >
        > <<a href= <<% GetLink(); %>>My Link<</a>>
        >
        > - Thanks,[/color]


        Comment

        Working...