in Education by

Explain the need of display mode in MVC?

1 Answer

0 votes
by

DisplayModes give you another level of flexibility on top of the default capabilities we saw in the last section. DisplayModes can also be used along with the previous feature so we will simply build off of the site we just created.

 

Using display modes involves in 2 steps

  1. We should register Display Mode with a suffix for particular browser using “DefaultDisplayMode”e class inApplication_Start() method in the Global.asax file.
  2. View name for particular browser should be appended with suffix mentioned in first step.
Most Asked ASP.NET MVC Interview Questions and Answers 
  1. Desktop browsers (without any suffix. e.g.: Index.cshtml, _Layout.cshtml).
  2. Mobile browsers (with a suffix “Mobile”. e.g.: Index.Mobile.cshtml,Layout.Mobile.cshtml)
     
    If you want design different pages for different mobile device browsers (any different browsers) and render them depending on the browser requesting. To handle these requests you can register custom display modes. We can do that using DisplayModeProvider.Instance.Modes.Insert(int index, IDisplayMode item) method.

Related questions

0 votes
    Explain the concept of MVC Scaffolding?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
0 votes
    What is Scaffolding in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What are the methods of handling an Error in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is difference between MVC and Web Forms?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What are the Folders in MVC application solutions?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is Database First Approach in MVC using Entity Framework?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is Validation Summary in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is Bundling and Minification in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
0 votes
0 votes
0 votes
    How do you implement Forms authentication in MVC?...
asked Apr 5, 2021 in Education by JackTerrance
...