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>
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:
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?
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:
Assuming of course that "itemUrl" is a property of your current page.
Cheers,
Michael
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.
Yep,
We're so focused on our "complex" things that we sometimes forget about the "basics" ;-)
Have a nice week-end!
Cheers,
Michael.
is working on a reply...