The name ‘DisplayModes’ does not exist in the current context
The error above is caused from the following code:
[sourcecode lang=”csharp”]
@{
Layout = "~/Views/Shared/_Layout.cshtml";
DisplayModes.RequireConsistentDisplayMode = true;
}
[/sourcecode]
Solution:
Replace
[sourcecode lang=”csharp”]DisplayModes.RequireConsistentDisplayMode = true;[/sourcecode]
with
[sourcecode lang=”csharp”]DisplayModeProvider.Instance.RequireConsistentDisplayMode = true;[/sourcecode]
Did my solution solve your problem? Leave a reply.