June 5, 2019

Srikaanth

Accenture ASP.NET MVC Recent Interview Questions

How We Can Handle The Exception At Controller Level In Asp.net Mvc?

Exception Handling is made simple in ASP.Net MVC and it can be done by just overriding "OnException" and set the result property of the filtercontext object (as shown below) to the view detail, which is to be returned in case of exception.

protected overrides void OnException(ExceptionContext filterContext)

    {


    }

What Is Razor View Engine?

Razor is the first major update to render HTML in ASP.Net MVC 3. Razor was designed specifically for view engine syntax. Main focus of this would be to simplify and code-focused templating for HTML generation.

Below is the sample of using Razor:

@model ASP.Net MVCMusicStore.Models.Customer

@{ViewBag.Title = "Get Customers";}

< div class="cust">

@Model.CustomerName

What Are Model Binders In Asp.net Mvc?

For Model Binding we will use class called : "ModelBinders", which gives access to all the model binders in an application. We can create a custom model binders by inheriting "IModelBinder".
Accenture ASP.NET MVC Recent Interview Questions And Answers
Accenture ASP.NET MVC Recent Interview Questions

Does Tempdata Hold The Data For Other Request In Asp.net Mvc?


If Tempdata is assigned in the current request then it will be available for the current request and the subsequent request and it depends whether data in TempData read or not. If data in Tempdata is read then it would not be available for the subsequent requests.

Explain Keep Method In Tempdata In Asp.net Mvc?

As explained above in case data in Tempdata has been read in current request only then "Keep" method has been used to make it available for the subsequent request.

@TempData["TestData"];

TempData.Keep("TestData");

What Is Area In Asp.net Mvc?

Area is used to store the details of the modules of our project. This is really helpful for big applications, where controllers, views and models are all in main controller, view and model folders and it is very difficult to manage.

What Are Child Actions In Asp.net Mvc?

To create reusable widgets child actions are used and this will be embedded into the parent views. In ASP.Net MVC Partial views are used to have reusability in the application. Child action mainly returns the partial views.

Explain The Advantages Of Dependency Injection (di) In Asp.net Mvc?

Below are the advantages of DI :

Reduces class coupling
Increases code reusing
Improves code maintainability
Improves application testing

What Are The Differences Between Partial View And Display Template And Edit Templates In Asp.net Mvc?

Display Templates : These are model centric. Meaning it depends on the properties of the view model used. It uses convention that will only display like divs or labels.

Edit Templates : These are also model centric but will have editable controls like Textboxes.

Partial View : These are view centric. These will differ from templates by the way they render the properties (Id's) Eg : CategoryViewModel has Product class property then it will be rendered as Model.Product.ProductName but in case of templates if we CategoryViewModel has List then @Html.DisplayFor(m => m.Products) works and it renders the template for each item of this list.

What Is The Use Of View Model In Asp.net Mvc?

View Model is a plain class with properties, which is used to bind it to strongly typed view. View Model can have the validation rules defined for its properties using data annotations.

What You Mean By Routing In Asp.net Mvc?

Routing is a pattern matching mechanism of incoming requests to the URL patterns which are registered in route table. Class : "UrlRoutingModule" is used for the same process.


How We Can Multiple Submit Buttons In Asp.net Mvc?

Below is the scenario and the solution to solve multiple submit buttons issue. Scenario :

@using (Html.BeginForm("MyTestAction","MyTestController")

{

    <input type="submit" value="MySave" />

    <input type="submit" value="MyEdit" />

} Solution :

Public ActionResult MyTestAction(string submit) //submit will have value either "MySave" or "MyEdit"

{

    // Write code here

}


What Are Actions In Asp.net Mvc?

Actions are the methods in Controller class which is responsible for returning the view or json data. Action will mainly have return type : "ActionResult" and it will be invoked from method : "InvokeAction()" called by controller.


https://mytecbooks.blogspot.com/2018/01/accenture-aspnet-mvc-recent-interview.html
Subscribe to get more Posts :