October 14, 2018

Srikaanth

Sitel Most Frequently Asked ASP.NET MVC Interview Questions Answers

What Are Validation Annotations?

Data annotations are attributes which can be found in the "System.ComponentModel.DataAnnotations" namespace. These attributes will be used for server-side validation and client-side validation is also supported. Four attributes - Required, String Length, Regular Expression and Range are used to cover the common validation scenarios.

Why To Use Html.partial In Asp.net Mvc?

This method is used to render the specified partial view as an HTML string. This method does not depend on any action methods.

We can use this like below

@Html.Partial("TestPartialView")

What Is The Need Of Action Filters In Asp.net Mvc?

Action Filters allow us to execute the code before or after action has been executed. This can be done by decorating the action methods of controls with ASP.Net MVC attributes.

Mention Some Action Filters Which Are Used Regularly In Asp.net Mvc?

Below are some action filters used

Authentication
Authorization
HandleError
OutputCache

How Can We Determine Action Invoked From Http Get Or Http Post?

This can be done in following way : Use class : "HttpRequestBase" and use the method : "HttpMethod" to determine the action request type.
Sitel Most Frequently Asked ASP.NET MVC Interview Questions Answers
Sitel Most Frequently Asked ASP.NET MVC Interview Questions Answers

In Server How To Check Whether Model Has Error Or Not In Asp.net Mvc?

This can be done in following way : Use class : "HttpRequestBase" and use the method : "HttpMethod" to determine the action request type.

How To Make Sure Client Validation Is Enabled In Asp.net Mvc?

In Web.Config there are tags called : "ClientValidationEnabled" and "UnobtrusiveJavaScriptEnabled". We can set the client side validation just by setting these two tags "true", then this setting will be applied at the application level.

< add key="ClientValidationEnabled" value="true" />

< add key="UnobtrusiveJavaScriptEnabled" value="true" />

What Is Html.renderpartial?

Result of the method : "RenderPartial" is directly written to the HTML response. This method does not return anything (void). This method also does not depend on action methods. RenderPartial() method calls "Write()" internally and we have to make sure that "RenderPartial" method is enclosed in the bracket. Below is the sample code snippet : @{Html.RenderPartial("TestPartialView"); }

What Is Routeconfig.cs In Asp.net Mvc 4?

"RouteConfig.cs" holds the routing configuration for ASP.Net MVC. RouteConfig will be initialized on Application_Start event registered in Global.asax.

What Are Scaffold Templates In Asp.net Mvc?

Scaffolding in ASP.NET ASP.Net MVC is used to generate the Controllers,Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views.

Explain The Types Of Scaffoldings?

Below are the types of scaffoldings

Empty
Create
Delete
Details
Edit
List

Can A View Be Shared Across Multiple Controllers? If Yes, How We Can Do That?

Yes we can share a view across multiple controllers. We can put the view in the "Shared" folder. When we create a new ASP.Net MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages.

What Are The Components Required To Create A Route In Asp.net Mvc?

Name - This is the name of the route.

URL Pattern : Placeholders will be given to match the request URL pattern.

Defaults :When loading the application which controller, action to be loaded along with the parameter.

Why To Use "{resource}.axd/{*pathinfo}" In Routing In Asp.net Mvc?

Using this default route - {resource}.axd/{*pathInfo}, we can prevent the requests for the web resources files like - WebResource.axd or ScriptResource.axd from passing to a controller.

Can We Add Constraints To The Route? If Yes, Explain How We Can Do It?

Yes we can add constraints to route in following ways

Using Regular Expressions
Using object which implements interface - IRouteConstraint.

What Are The Possible Razor View Extensions?

Below are the two types of extensions razor view can have

.cshtml : In C# programming language this extension will be used.

.vbhtml - In VB programming language this extension will be used.

What Is Partialview In Asp.net Mvc?

PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it's been shared with multiple views these are kept in shared folder.

Partial Views can be rendered in following ways

Html.Partial()
Html.RenderPartial()

https://mytecbooks.blogspot.com/2018/10/sitel-most-frequently-asked-aspnet-mvc.html
Subscribe to get more Posts :