0

I am using below line of code in my DWT.

<h2>
    <a tridion:href="@@Component.ID@@">
        <%=Html.ServerDecode("@@Component.Fields.Name@@")%>
    </a>
</h2>

When I visit website it shows me string <%=Html.ServerDecode("@@Component.Fields.Name@@")%> as it is because it's become Linktext property and is treated as a string rather than .net server side code. Can someone suggest me the solution?

2
  • Is it resolved?
    – Raj Kumar
    Jun 9, 2014 at 5:34
  • Yes, it's got resolved as per suggestion given by archit. Jun 10, 2014 at 6:27

2 Answers 2

2

Try using the following code snippet in your DWT

<h2>
    <a tridion:href="@@Component.ID@@">@@HTMLDecode(Component.Fields.Name)@@</a>;
</h2>
1

There seems another issue with your dwt, @@Component.Fields.Name@@ should have been resolved to component name after publishing.

When page is publish this anchor tag will be converted to

<tag attr2="" atr1="" >

and all special characters like "<" are encoded, so server code will never execute, just print on the page

You can use C# fragment/tbb

  • in c# code do the encoding, push in package.
  • get the value from package and include wherever required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.