The name 'media' does not exist in the current context
The @
is a reserved character in Razor. But you can escape it using @@
:
@@media print
In razor views, @
is the magic character which preceeds code.
In your case, use 2 @@
. Otherwise razor will thing that it is some code/ expression.
@@media print.
Alternatively you can use Html.Raw
method also.
@Html.Raw("@")media print
You can do the same when printing twitter handle name which has the @
in it.
Here is a good msdn link to know more about razor syntax and here is one from phil hack