How do I escape my javascript so I can perform the following?
This is an example:
It's not outputting 'Month1', 'Month2' etc. and instead it is actually outputting 'Month@i'.
@for (int i = 0; i < 12; i++)
{
<text>
{
field: 'Month@i',
title: ,
width: 10
},
</text>
}
Thanks.
The main problems is that Month@i is wrongly interpreted as an email address, so you need to use explicit expressions @(...) to tell the Razor that this is a code expression. This is the best solution:
@for (int i = 0; i < 12; i++)
{
<text>
{
field: 'Month@(i):',
title: ,
width: 10
},
</text>
}
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