Skip to content Skip to sidebar Skip to footer

Displaying A Literal Period Following Razor Syntax

How can I escape the razor engine to print a literal period after my property value? The compiler is interpreting the period as to be followed by a method or property, so it throw

Solution 1:

Wrap it in parenthesis (assuming INSTRUMENT_NUM is a property of item and not to be printed as literal - adapt the closing parenthesis location if this is not the case):

col.Custom(@<a href="http://someurl/@(item.INSTRUMENT_NUM).pdf">@item.INSTRUMENT_NUM</a>)
   .Named("Instrument Number");

Post a Comment for "Displaying A Literal Period Following Razor Syntax"