Skip to main content
1 of 3
Girish
  • 101
  • 2
  • 8

How to set anchor tags href value using SharePointWebControls:FieldValue column?

I am trying to set the value for href attribute of an anchor tag in one of my SharePoint Publishing Site layout pages. I need to set the value to the value stored in one of the columns in page's content type. I tried the following line, but I got an error message given below.

<a href='<%=<SharePointWebControls:FieldValue FieldName="SomeColumn" runat="server" /> %>'>Click here</a>

Error Message:

An error occurred during the processing of /_catalogs/masterpage/SomeLayoutPage.aspx. Code blocks are not allowed in this file.

Can anyone help me with this? I know that I can just use SharePointWebControls:UrlField control to get the link displayed on the page, but I'd like to have access to the value directly for other purposes too (like using the value for embeding YouTube video player etc.)

Thanks in advance!

Regards, Girish

Girish
  • 101
  • 2
  • 8