Tag Archives: MVC

MVC

What are partial views in MVC?

Hi All, Partial view is a reusable view which can be embedded inside other view.Like a user control it can be used in different areas of a page. It can used with left menu, header and footer as shown in the image below. Once the partial view is created we can call the partial view… Read More »

Routing in MVC?

Hi All, Routing helps us to give user friendly URL structure. Helps to map those URL structure to the controller.When any user types “http://localhost/View/ViewStudent/” , it will goes to the “Customer” Controller and invokes “DisplayStudent” action. This is defined by adding an entry in to the “routes” collection using the “maproute” function.

What is the difference between tempdata , viewdata and viewbag?

Temp data: Helps to maintain data when you move from one controller to other controller or from one action to other action. In other words when you redirect,“tempdata” helps to maintain data between those redirects. It internally uses session variables. View data: Helps to maintain data when you move from controller to view. View Bag: … Read More »

How can we restrict MVC actions to be invoked only by GET or POST?

Hi Friends, We can decorate the MVC action by “HttpGet” or “HttpPost” attribute to restrict the type of HTTP calls. For instance you can see in the below code snippet the “DisplayCustomer” action can only be invoked by “HttpGet”. If we try to make Http post on “DisplayCustomer” it will throw an error.    

Explain the brief history of ASP.NET MVC?

Hi friends, I have gone through some existing features of MVC in its history. MVC Framework have too many features and in each release they have added new features. ASP.NET MVC1 MVC1 was Released on Mar 13, 2009 Runs on .NET 3.5 Runs in Visual Studio 2008 & Visual Studio 2008 SP1 MVC Pattern architecture… Read More »

Microsoft Unity in Web Applications

The Unity Application Block (Unity) is a lightweight container for dependency injection. Using DI frameworks developers can generate and assemble instances of custom classes and objects that can contain dependent object instances and settings. 1. Constructor injection 2. Method call injection 3. Property injection It helps developers with the following features : Simplifies code Specify… Read More »

What is MVC ?

MVC is an architectural pattern. It separates the representation and the user interaction in an Application. In MVC there are three important sections. Model,View and Controller. Please see details below. View is responsible for look and feel. Model provides data to the View. Controller is responsible to take the end user request and load the… Read More »

DTO (Data Transfer objects) in C#

DTO (Data Transfer objects) is a container for passing data between layers. DTO’s are also termed as transfer objects. DTO is used to pass data and does not contain any business logic in it. Setters and Getters are used in DTO.