Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jos Huybrighs 23 posts 55 karma points
    Feb 11, 2011 @ 15:45
    Jos Huybrighs
    0

    Putting a page field in the NavigateUrl of an asp:HyperLink tag

    Probably a stupid question but I can't figure out how to insert a page field in the NavigateUrl of an <asp:HyperLink..> tag which I want to have in my template to open a link in a new browser tab (using the Target=_blank attribute).

    I tried the following:

    <p>Click <asp:HyperLink Target="_blank" runat="server"
              NavigateUrl='<umbraco:Item field="itemUrl" runat="server" />'
              Text="here" />to open the newsletter.</p>

    But this didn't render the expected url.

    Any thoughts on this?

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Feb 11, 2011 @ 16:08
    Michael Latouche
    0

    Hello Jos,

    If you want to use a server-side Hyperlink, my guess is you will need to do this in the code-behind. But if your only concern is to get a target="_blank" attribute, I think you can actually achieve this with a "client-side" <a> element:

    <a href="<umbraco:Item field="itemUrl" runat="server" />" title="Title" alt="alt" target="_blank">some text</a>

    Assuming of course that "itemUrl" is a property of your current page.

    Cheers,

    Michael

  • Jos Huybrighs 23 posts 55 karma points
    Feb 11, 2011 @ 16:28
    Jos Huybrighs
    0

    Thanks Michael.

    I am so used in using the <asp:HyperLink> tag that I didn't realize that the <a> tag also has this attribute of course.

  • Michael Latouche 504 posts 819 karma points MVP 4x c-trib
    Feb 11, 2011 @ 17:01
    Michael Latouche
    0

    Yep,

    We're so focused on our "complex" things that we sometimes forget about the "basics" ;-)

    Have a nice week-end!

    Cheers,

    Michael.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies