Alexander Beletsky
Alexander Beletsky

Reputation: 19841

ASP.NET MVC4 Mobile: CS0103: The name 'DisplayModes' does not exist in the current context

Playing with a Mobile application in ASP.NET MVC4 beta, using great that article, but having issues with Display modes. Namely, I try to use

@{
    ViewBag.Title = "ASP.NET Articles";
    DisplayModes.RequireConsistentDisplayMode = true;    
}

inside my _ViewStart.cshtml, but getting an complition error:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'DisplayModes' does not exist in the current context

Does any one see that as well?

Upvotes: 2

Views: 1817

Answers (1)

nemesv
nemesv

Reputation: 139818

The linked article is from September 12, 2011 so it seems they changed the API.

Try this (it works in MVC4 beta):

@{
    ViewBag.Title = "ASP.NET Articles";
    DisplayModeProvider.Instance.RequireConsistentDisplayMode = true;
}

Upvotes: 3

Related Questions