The following line does not compile when I put in a Razor View.
var extPropLookupNameCompania = $"extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}";
However in the controller the same line works perfectly fine.
Why I cant user string interpolation on the razor views? or Maybe I need to configure something?
You have to encapsulate it with braces like this:
EDIT: I updated because there was a missing curly.
var extPropLookupNameCompania = $("{extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}");
I tried the following successfully:
@($"It is {DateTime.Now}")
If you are experiencing this error in a .NET Framework 4.5.1 project, upgrading to 4.5.2 solves the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With