ASP.Net MVC Interview Questions Part 2

What are Custom Control and User Control?

Custom Controls are controls generated as compiled code (Dlls), those are easier to use and can be added to toolbox. Developers can drag and drop controls to their web forms. We can easily add custom controls to Multiple Applications (If Shared Dlls). So, If they are private, then we can copy to dll to bin directory of web application and then add reference and can use them.

User Controls are very much similar to ASP include files, and are easy to create. User controls can’t be placed in the toolbox and dragged – dropped from it. They have their design and code-behind. The file extension for user controls is ascx.

Different level of state management in

State management is the process of maintaining state and page information over multiple request for same or different pages.
There are 2 types of state management 1.Client side state management 2.Server side state management

*View state*Application state
*control state*Session state
*Hidden field

The web application is persistence in nature means webserver doesn’t record each and every request in server memory and it thinks each and every request is a new request.
Now to preserve persistency between request we can use various techniques like hidden field storage, session, cookie, view state.

Session stores data and object but on server.Cookies store only data and stores on client and small amount of data.
Session can store any type of data because value is of datatype object.Cookies can store only string
These are stored at server side.Cookies are stored at client side.
Session are secure because it is stored in binary format encrypted form and it gets decrypted at server.Cookies is non-secure since stored in tent format at client side.
Session is independent for every client i,e individual for every request.Cookies may or may not be individual for every client.
There is no limitation on size.Size of cookie is limited to 4 and no of cookies is restricted to 20.
We cannot disable session.We can disabled cookies.
The disadvantage of session is that it is a burden on server.Client side.
Session are called as non-persistent coolies because its life time can be set manuallyWe have persistent and non-persistent cookies.

ASP.Net MVC Interview Questions

Explain aspx page feature and properties?

Default page header: <%@Page language= “c#” master page file=~-master. Enable event validation=”false” Auto event wire up=”true” code file=”catego.cs” Inherits=”cate go” Title=”Title” %>.
Language: The language which is used for code behind.
Enable event validation: For security reason its probably best to leave it to true.
This event validation is designed to protect the website from having values injected into page that can be used to exploit the application.
Auto event wire up: By default it is true. when it is true the page framework calls page events automatically.
If you do set auto event wire up to true, visual studio will generate code to bind the event and the page framework will automatically call events based on their names.
This can result in the same event code being called twice when the page runs.
As a consequence, you should always leave auto event wire up set to false when working.
Code file: Shows the code file.
Inherits: Shows the class name of page.
Title: Give the title.

Explain Strong Name?

Strong name: A strong name consist of the assembly’s identity its simple text name, version number and culture information (if provided)plus a public key and digital signature. It is generated from assembly file.
Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name that you can because an assembly generated with one private key has a different name than an assembly generated with another private key.

What is GAC in .NET?

GAC in .NET: The global assembly cache stores assemblies specifically designated to be shared by several application on the computer.
We should share assemblies by installing them into global assembly cache one when we need.
Assemblies deployed in GAC must have strong name.

Advance ASP.Net MVC Interview Questions

Explain Reflection?

Reflection: It extends the benefits of metadata by allowing developers to inspect and use it at run time.
for eg: To determine all the classes contained in given assembly and involve their methods.

Explain CLR and properties?

CLR: Common Language Runtime is the execution engine for .NET framework application. It provide services like below:

Code management.
Application memory isolation.
Verification of type safety.
Conversion of IL to native code.
Managing memory for managed object.
Exception handling.

What are types of Assemblies?

Assembly type:1.Private assemblies 2.Shared assemblies.

ASP.Net MVC Interview Questions

Explain web service?

Web service: A web service is a software component that exposes itself through the open communication channels of internet.
Application running on remote machine on potentially different platform can access these components in a language and platform independent manner.

Difference between ASP .NET webforms and Asp .NET MVC? Web forms user page controuer pattern approach for rendering layout. IN this approach every page has its own controller i.e. code behind file that process the request.
On the other hand , MVC uses front controller approach. In this approach a common controller for all pages, process the request.

Asp.Net Web form Asp.netmvc
No separation of concerns.Every page(.asp) has its own controller(i.e,codebehind) so both are tightly coupled.Very clean separation of concerns, view and controller are neatly separate.
Because of this coupled behaviour, automated testing is really difficultTestability is a key feature in Asp.netmvc.
In order to achieve statefull behavior, viewstate is used.(just like inwin form).Asp.netmvc approach is stateless as that of web so no concept of view state. Web form model follows a page life cycle.No page life cycle like webforms.
With lots of control libraries availability and limited knowledge of other related technologies, web forms is RAD
(rapid Application Development) approach.
Its a step back for developer decrease in productivity
In good for small scale application with limited team size.Its better as well as recommonded approach for large scale application. Web form has user controls for code mvc has portial view for code re-usability. Web form is not open web mvc is an open source.

Difference between custom control and user control?

Custom control are basically complied code i.e., DLLs. These can be easily added to it can be easily used across multiple project using drag and drop approach.
User control are (.ascx) are just like page (.aspx). These are comparatively easy to create but tightly coupled with respect to user interface and code. In order to use across multiple project. We need to copy paste to other project as well.

Custom control can be used for global purpose like toolbar controls.User control can be used for local purpose .Once you create it can be accessed in current project.
It is a dll file so entension is.dll.User control extension is.ascx file.
It can be added to toolbox.It can be visible solution explorer.
If you want to use in any format just drage like other controls.If you want to use just drage from solution or registerlike <%@register tagprofin=”scott” tagname=”header” src=”controls/header.ascx”%>

Advance ASP.Net MVC Interview Questions

What is connection pool?

A connection pool is a collection of connection which are shared between the clients requesting one.
Once the connection is closed, it returns back to the pool. This allows the connections to be reused.

ASP .NET page life cycle(2.0)?

On preInit
OnInit complete
Load view state
Onpre load
Raise post back event
Onload complete
Save view state
On Render
On Unload page life cycle events?

When a page request is sent to the web server, the page is run through a series of events during its creation and disposal.
7.Load complete
9.Save State Complete

1.PREINIT:The entry point of the page life cycle is the pre-initialization phase called prelimit. This is the only event where programmatic access to master pages and themes is allowed. We can dynamically set the values of master pages and them in this event you can also dynamically create control in this event.
2.INIT:This event fires after each control has been initialized each contro is uniqueIn is set and any skin setting have been applied, you can use this event to change initialization value for controls. The “Init” event is fired first for the most bottom control in the heiraschy and then fired up the heiraschy until is fired for page itself.
Note that the page-Init event fires only the first time the page is loaded. When you use a web form and post back to this page again;the page-Init event doesn’t fire but the page-load event fires each time the page load.
3.INITCOMPLETE:Init complete Raised once all initialization of the page and its control have been completed till now the view state value are not yet loaded, hence we can use this event to make change to view state that you want to make sure are persisted after the next post back.
4.PRELOAD:It is Raised after the page loads view state for itself and all controls, and after it processes post back data that is included with the request instance.

LOAD VIEWSTATE: View state data are loaded to controls. The page view state is managed by Asp .NET and is used to persist information over a page roundtrip to the server. View state information is saved as a string of name/value pairs and contains information such as control text or value. The view state is held in the value property of hidden control that is passed from page request to page request.
LOAD POSTBACK DATA: Post back data are now handed to the page controls. During this phase of the page creation, from data that was posted to the server(termed post data in Asp .NET) is processed against each control that required it.
Hence, the page fires the load post data event and passes through the page to find each control and update the control state with the correct post back data. Asp .NET updates the correct control by matching the control is unique ID write the name/value pair in the name value collection. This is one reason that Asp .NET requires unique IDs for each control on any given page.
5.LOAD:By the time this event fires the page has been restored to its previous state in case of post back. Code inside the page load event typically check for poatback and then sets control properties appropriately.
This method is mostly used because this is the first place in page lifecycle that all values are restored. We can check the value of is Poatback to avoid unnecessarily resetting state.
6.CONTROL(POSTBACK)EVENTS: Asp .NET now calls any events on the page or its controls that caused the postback to occur. This might be a button click event or a dropdown’s select indechange event, for eg: These are the events, the code for which is written in code behind class.
7.LOADCOMPLETE:This event signal the end of load.
8.PRERENDER:It allows final change to the page or its control. This event takes place after all regular postback events have taken place. This event takes place before saving view state, so any changes made here are saved.for eg:After,this event we cannot change any property of a button or change any view state value because after this event, save statecomplete and Render events are called.
9.SAVESTATECOMPLETE:Prior to this event the view state for the page and its controls is set. Any change to the page’s controls at this point or beyond are ignored.
10.RENDER:This is a method of the page object and its control(and not an event).At this point ,Asp .NET calls this method on each of the page’s controls to get its output.
The Render method generates the client-side HTML, DHTML and script that are necessary to properly display a control at the browser.(view source will show rendered HTML).
11.UNLOAD:This event is used for cleanup code. After the page’s HTML is rendered, the object are disposed of during this event, you should destroyed any object or reference you have created in building the page. At this point, all processing data occurred and it is safe to dispose of any remaining object including the page object.
clean up can be performed on:
(a)Instance of classes i.e. object.
(b)Closing opened files.
(C)Closing DB connection.

ASP.Net MVC Interview Questions

What is Java script and Ajax?

JS is a scripting language and mainly used for client side validation. We can validate the client side data before sending to the server. So by this we can improve the performance of applx.
Ajax is synchronous JavaScript and XML which is used for the asynchronous calls from the server it user internally the JavaScript for making the calls and use XML for the data transfer. It basically uses the Xml +++p request for the asynchronous calls to the server and communicates with the Xml data which platform independent. So Ajax can be used with any technology.
JavaScript can be used for client side ralidation, can also be used for calling of server side methods and function, can be used for calling webservices etc. If we want to call the JavaScript fn from the code behind, we need to attach the JS to the events in page-load events.
Prot void btnsave-click(obj sen,eve)
btnsave.Adtributes.Add(“or click,”javascript:returnvaliddata();”);
here validatedata is JS fn which can be used to validate the page data and if validation fails, it will return and will not execute the serrverside btn-save-click event.

What is JQUERY?

jQuery is a JavaScript code. Can be called as JavaScript library or framework comitten in JavaScript. JavaScript helps in to make animations, add Ajax interaction, manipulate page content, and providingu1 effects.

Used to develop browser compatiable web applx.
Improving performance of applex.
Has Ajax capabitiles and easy to use and learn.
Many methods and plug for various need.

What is minimized version of jQuery?

JQUERY lines come in 2 different version.
1.Development user.

The deployment version known as verified version. The difference is mini is small and load quickly and saver bandwidth.

Advance ASP.Net MVC Interview Questions

Various way to include jQuery in a page?

Local copy inside script tag.
Remote copy of
Remote copy of Ajax APl.

What is CDN?

CDN is abbreviation for content distribution network and it is a group companies in different location with network containing copies of data files to minimize bandwidth in accessing data.
2 types of CDNs

Microsoft—>load jQuery from ajax CDN
Google—>load jQuery from google libraries.

What is JSON?

JSON is an abbreviation for JavaScript object notation.
JSON helps us to present and exchange data in a self descriptive, independent light way.
eg: VAR x={“customercode”:”1001″,”customername”:”name”}

ASP.Net MVC Interview Questions

What is JSON structure?

A connection of name/value pairs. These are universal data structure supported.
A JSON object is an unordered set of name/value pairs.
It begins with {(left brace) and end with (right brace)
Each name is followed by:(color) and name/value pairs are separated by(coona).

How to send JSON data to server side?

—>create JSON java object.
—>Add name and value pairs using putr method.
—>Convert it to string type using string method and send it to the client with context type as\”text/XML\” or \”text/place\”.
My string= new JSON object ()put (\”JSON\” “hellow,world!\”).tosting();

What is the role of components Presentation, Abstraction, and Control in MVC?

“Here is the role of components Presentation, Abstraction, and Control in MVC:

Presentation: It is the visual representation of a specific abstraction within the application
Abstraction: It is the business domain functionality within the application
Control: It is a component that keeps consistency between the abstraction within the system and their presentation to the user in addition to communicating with other controls within the system”

Advance ASP.Net MVC Interview Questions

What are the drawbacks of the MVC model?

“Here are some important drawbacks of the MVC model:

The model pattern is a little complex.
Inefficiency of data access in view.
With a modern user interface, it is difficult to use MVC.
You need multiple programmers for parallel development.
Multiple technology knowledge is required.”

What is the role of “Action Filters” in MVC?

In MVC, “Action Filters” help you to execute logic while MVC action is executed or it is executing.

What are the steps for the execution of an MVC project?

“The steps for the execution of an MVC project includes:

Receive the first request for the application
Perform routing
Create an MVC request handler
Create Controller
Execute Controller
Invoke action
Execute Result”

ASP.Net MVC Interview Questions

How routing is done in the MVC pattern?

“There is a group of routes called the Route Collection, which consists of registered routes in the application. The Register Routes method records the routes in this collection. A route defines a URL pattern and a handler to use if the request matches the pattern.

The first parameter to the Map Route method is the name of the route. The second parameter will be the pattern to which the URL matches. The third parameter might be the default values for the placeholders if they are not determined.”

“By using “”Action Link”” method as shown in the below code. The below code will make a simple URL that helps to navigate to the “”Home”” controller and invoke the “”Go to Home”” action.

Collapse / Copy Code

<%= Html.ActionLink(“”Home””, “”Gotohome””) %>”

How can you create views in PHP?

“Here is a code to create views in PHP:

JavaScript Libraries – Opinion Poll

JavaScript Libraries – Opinion Poll

YUI Library
Let’s now create the results page results.php
JavaScript Libraries – Opinion Poll Results

    <h3>JavaScript Libraries - Opinion Poll Results</h3>

    <p><b>What is your favorite JavaScript Library?</b></p>

    <p><b><?php echo $total_votes; ?></b> people have thus far taken part in this poll:</p>


        <?php print($rows); ?>


    <p><a href=""/"">Return to voting page</a></p>

Advance ASP.Net MVC Interview Questions

“Here are popular PHP MVC frameworks:

CodeIgniter: It is one of the most popular PHP MVC frameworks. It’s lightweight and has a short learning curve. It has a rich set of libraries that help build websites and applications rapidly. Users with limited knowledge of OOP programming can also use it.

Kohana: It’s a Hierarchical Model View Controller HMVC that is a secure and lightweight framework. It has a rich set of components for developing applications rapidly.

Cake PHP: It is modeled after Ruby on rails. It’s known for concepts such as software design patterns, convention over configuration, Active Record, etc.

Zend: It is a powerful framework that is;

Secure, reliable, fast, and scalable
Supports Web 2.0 and creation of web services.
It features APIs from vendors like Amazon, Google, Flickr, Yahoo, etc. It’s ideal for developing business applications.”

Why use PHP MVC Framework?

“You should use PHP MVC Framework because it simplifies working with complex technologies by:

Hiding all the complex implementation details
Providing standard methods that we can use to build our applications.
Increased developer productivity, this is because the base implementation of activities such as connecting to the database, sanitizing user input, etc., are already partially implemented.
Adherence to professional coding standards”

How can you create a model in PHP?

“Here is a code to create model in PHP:


public function total_votes() 
    $query = $this->db->select('COUNT(choice) as choices_count')->get('js_libraries');
    return $query->row()->choices_count; 

public function get_results() 
    $libraries = array("""", ""JQuery"", ""MooTools"", ""YUI Library"", ""Glow""); 
    $table_rows = ''; 

    for ($i = 1; $i < 5; $i++) 
         $sql_stmt = ""SELECT COUNT(choice) choices_count FROM js_libraries WHERE choice = $i;""; 
         $result = $model->

         select($sql_stmt); $table_rows .= ""<tr><td>"" . $ libraries [$i] . "" Got:</td><td><b>"" . $result[0] . ""</b> votes</td></tr>""; 
    public function add_vote($choice) 
        $ts = date(""Y-m-d H:i:s""); $data = array('choice' => $choice, 'ts' => $ts); $this->db->insert('js_libraries', $data); 


ASP.Net MVC Interview Questions

What is the role of MVC in AngularJS?

The controller’s primary responsibility is to control the data which gets passed to the view. The scope and the view have two-way communication.
The properties of the view can call “”functions”” on the scope. Moreover, events on the view can call “”methods”” on the scope. The below code snippet gives a simple example of a function.
The function($scope) which is defined when defining the controller and an internal function which is used to return the concatenation of the $scope.firstName and $scope.lastName.
In AngularJS when you define a function as a variable, it is known as a Method.

Data in this way pass from the controller to the scope, and then the data passes back and forth from the scope to the view.
The scope is used to expose the model to the view. The model can be modified via methods defined in the scope, which could be triggered via events from the view. We can define two-way model binding from the scope to the model.
Controllers should not ideally be used for manipulating the DOM. This should be done by the directives, which we will see later on.
The best practice is to have controllers based on functionality. For example, if you have a form for input and you need a controller for that, create a controller called “”form controller””.”

What is MVC in AngularJS?

“The Controller represents the layer that has the business logic. User events trigger the functions which are stored inside your controller. The user events are part of the controller.
Views are used to represent the presentation layer which is provided to the end-users.
Models are used to represent your data. The data in your model can be as simple as just having primitive declarations. For example, if you are maintaining a student application, your data model could just have a student id and a name. Or it can also be complex by having a structured data model. If you are maintaining a car ownership application, you can have structures to define the vehicle itself in terms of its engine capacity, seating capacity, etc.”

How can you ensure that Web API returns JSON data only?

“To make Web API serialize the returning object to JSON format and returns JSON data only. For that, you should add the following code in Web ApiConfig.cs class in any MVC Web API Project:



Config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(“”application/json””));



Config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue(“”application/json””))”

Advance ASP.Net MVC Interview Questions

What is the main difference between MVC and Web API?

“Here is the main difference between MVC and Web API:

MVC framework is used for developing applications that have a User Interface. For that, views can be used for building a user interface.

Web API is used for developing HTTP services. Other apps can also be called the Web API methods to fetch that data.”

How can you assign an alias name for ASP.NET Web API Action?

“We can give alias name for Web API action same as in case of ASP.NET MVC by using “”Action Name”” attribute as follows:



public void UpdateStudent(Student aStudent)

Can you create a web application with both webforms and MVC?

“Yes. You need to include the below MVC assembly references in the web forms application to create a hybrid application.


ASP.Net MVC Interview Questions

Write a code to demonstrate Model, View, and Controller in CodeIgniter.

“Here is a code to demonstrate Model, View, and Controller in CodeIgniter:

Open the file Welcome.php controller located application/controllers:

defined(‘BASEPATH’) OR exit(‘No direct script access allowed’);

class Welcome extends CI_Controller {
public function index()
Update the index as follows:

public function index()

        $data['customer'] = $this->customers_model->get_customer(3);


Write the following code in customer_model.php in application/models.

class Customers_model extends CI_Model {
public function get_customer($id) {
$data[‘id’] = 3;
$data[‘first_name’] = ‘John’;
$data[‘last_name’] = ‘Doe’;
$data[‘address’] = ‘Kingstone’;

    return $data;

Open welcome_message.php located in

Replace the code with the following
CodeIgniter MVC Basics

Customer Details Card

<p>Customer ID : <strong><?=$customer['id']?></strong></p>
<p>First Name  : <strong><?=$customer['first_name']?></strong></p>
<p>Last Name   : <strong><?=$customer['last_name']?></strong></p>
<p>Address     : <strong><?=$customer['address']?></strong></p>

What are the important points to remember while creating an MVC application?

“Here are some important points to remember while creating an MVC application:

You need to remember that MVC is not a replacement for ASP .NET web forms-based applications
The approach of MVC app development must be decided based on the application requirements and features provided by MVC to suit the specific development needs.
Application development process with ASP.NET MVC is more complex compared with web forms-based applications.
Application maintainability is always higher with the separation of application tasks.”

How MVC works in Spring?

“Here is how MVC works in Spring:

Dispatcher Servlet receives a request.
After that, the Dispatcher Servlet communicates with Handler Mapping. It also revokes the controller associated with that specific request.
The Controller processes this request by calling the service methods, and a Model And View object is returned by the Dispatcher Servlet.
The view name is sent to a View Resolver to find the actual View to invoke.
After that, Dispatcher Servlet is passed to View to render the result.
By using the model data, the View renders and sends back result back to the user.”

Advance ASP.Net MVC Interview Questions

How can you use MVC architecture in JSP?

“Following example shows the use of MVC architecture in JSP:

We are taking the example of a form with two variables, “”email”” and “”password”” which is our view layer.
Once the user enters email, and password and clicks on submit, then the action is passed in mvc_servlet where email and password are passed.
This mvc_servlet is controller layer. Here in mvc_servlet, the request is sent to the bean object, which acts as a model layer.
The email and password values are set into the bean and stored for further purposes.
From the bean, the value is fetched and shown in the view layer.

<%@ page language=””java”” contentType=””text/html; charset=ISO-8859-1″” pageEncoding=””ISO-8859-1″”%>
MVC Guru Example

package demotest;


import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


  • Servlet implementation class Mvc_servlet
    public class Mvc_servlet extends HttpServlet {
    private static final long serialVersionUID = 1L; /**
    • @see HttpServlet#HttpServlet()
      public Mvc_servlet() {
      // TODO Auto-generated constructor stub
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    String email=request.getParameter(“”email””);
    String password=request.getParameter(“”password””); TestBean testobj = new TestBean(); testobj.setEmail(email); testobj.setPassword(password); request.setAttribute(""gurubean"",testobj); RequestDispatcher rd=request.getRequestDispatcher(""mvc_success.jsp""); rd.forward(request, response); }


package demotest;

import Serializable;

public class Test Bean implements Serializable{

public String getEmail() {
    return email;
public void setEmail(String email) { = email;
public String getPassword() {
    return password;
public void setPassword(String password) {
    this.password = password;
private String email=""null"";
private String password=""null"";

What are the real-life example of MVC?

“Here is a real-life example of MVC:

Let’s assume you go to a restaurant. You will not go to the kitchen and prepare food which you can surely do at your home. Instead, you just go there and wait for the waiter to come on.
Now the waiter comes to you, and you just order the food. The waiter doesn’t know who you are and what you want he just written down the detail of your food order.
Then, the waiter moves to the kitchen. In the kitchen, the waiter does not prepare your food.
The cook prepares your food. The waiter is given your order along with your table number.
Cook then prepares food for you. He uses ingredients to cook the food. Let’s assume that you ordered a vegetable sandwich. Then he needs bread, tomato, potato, capsicum, onion, bit, cheese, etc., which the sources from the refrigerator
Cook finally hands over the food to the waiter. Now it is the job of the waiter to move this food outside the kitchen.
Now the waiter knows which food you have ordered and how it is served.
In this case,

View= You
Waiter= Controller
Cook= Model
Refrigerator= Data”

What are the features of MVC?

“Here are the features of MVC:

Easy and frictionless testability. Highly testable, extensible, and pluggable framework.
Offers full control over your HTML as well as your URLs
Leverages existing features provided by ASP.NET, JSP, Django, etc.
Clear separation of logic: Model, View, Controller. Separation of application tasks via business logic, Ul logic, and input logic.
URL Routing for SEO Friendly URLs. Powerful URL- mapping for comprehensible and searchable URLs.
Support for Test Driven Development (TDD).”

ASP.Net MVC Interview Questions

What are two instances where routing is not implemented or required?

“Two instances where routing is not required are

When a physical file is found that matches the URL pattern
When routing is disabled for a URL pattern

What are the two ways for adding constraints to a route?

“Two methods for adding constraints to the route are:

Using regular expressions
Using an object that implements IRouteConstraint interface”

How to render raw html in MVC view?

“You can use Html. Raw helper to render raw Html in MVC



Raw Example


Advance ASP.Net MVC Interview Questions

What’s new in the latest version of MVC?

In MVC 6 Microsoft removed the dependency of System. Web. Dll from MVC6 because it is extremely expensive, as it typically used to consume 30K of memory per request and response, whereas now MVC 6 only requires 2K of memory per request and the response is really small memory consumption.

What is GET and POST Actions Types?

“GET Action Type: GET is used to request data from a specified resource. With all the GET requests, we pass the URL, which is compulsory; however, it can take up the following overloads.

POST Action Type: The POST is used to submit data to be processed to a specified resource. With all the POST requests, we pass the URL, which is essential and the data. However, it can take up the following overloads. “

Explain what is Database First Approach in MVC using Entity Framework?

“Database First Approach is an alternative or substitutes to the Code First and Model First approaches to the Entity Data Model. The Entity Data Model creates model codes (classes, properties, dB Context, etc.) from the database in the project and that class behaves as the link between database and controller.

There are the following approaches, which are used to connect the database with the application.

Database First
Model First
Code First”

ASP.Net MVC Interview Questions

What is Validation Summary in MVC?

“The Validation Summary helper method generates an unordered list (UL element) of validation messages that are in the Model State Dictionary object.

The Validation Summary can be used to display all the error messages for all the fields. It can also be used to display custom error messages. The following figure shows how Validation Summary displays the error messages.”

Explain the need of display mode in MVC?

A display mode is a powerful tool for all mobile-based apps development. However, it is not limited to mobile web apps but it can also be used to display any alternative view, which is tied to an existing controller. Display Modes practically give you another level of flexibility on top of the default capabilities we saw in the last section. Display Modes can also be used along with the previous feature so the users will simply build off of the site they just created. It simplifies the ways to implement different versions of view for different devices. MVC Part MVC Part 3
Back to top