Category Archives: Asp.Net MVC

Asp.Net MVC

@Html.Action vs @Html.RenderAction in Asp.Net MVC

@Html.Action @Html.Action returns string. Syntax : @Html.Action(“Action”,”Controller”). Pass parameter with Action method Syntax : @Html.Action(“Action”,”Controller”, new {ParameterName=ParameterValue}). It is slower as compared to @Html.RenderAction. It’s result can be manipulated before rendering to the output stream. Manipulation : @{ var data= Html.Action(“Action”,”Controller”, new {ParameterName=ParameterValue}); } @data I am Software Developer. Use when data length is small or need to manipulate result Continue Reading…

@Html.Partial vs @Html.RenderPartial in Asp.Net MVC

@Html.Partial @Html.Partial returns string. Syntax : @Html.Partial(“Partial View Name”). Pass model with Partial method Syntax : @Html.Partial(“Partial View Name”, Model). It is slower as compared to @Html.RenderPartial. It’s result can be manipulated before rendering to the output stream. Manipulation : @{ var data= Html.Partial(“Partial View Name”); } @data I am Software Developer. Use when data length is Continue Reading…

How to call child action method in Asp.Net MVC.

Child action methods can not be called directly. They have to call from inside of a view. We can make an Action method a child action method by decorating it with [ChildActionOnly] attribute. Calling child action method from inside of a view Where “Child” is the Action method name and “Home” is the controller name.

When to use Attribute Routing?

The convention-based routing is complex to support certain URI patterns that are common in RESTful APIs. But by using attribute routing you can define these URI patterns very easily. For example, resources often contain child resources like Clients have orders, movies have actors, books have authors and so on. It’s natural to create URIs that Continue Reading…

What is Attribute Routing and how to define it?

ASP.NET MVC5 and WEB API 2 supports a new type of routing, called attribute routing. In this routing, attributes are used to define routes. Attribute routing provides you more control over the URIs by defining routes directly on actions and controllers in your ASP.NET MVC application and WEB API. Controller level routing – You can Continue Reading…

What is Routing in ASP.NET MVC?

Routing is a pattern matching system that monitor the incoming request and figure out what to do with that request. At runtime, Routing engine use the Route table for matching the incoming request’s URL pattern against the URL patterns defined in the Route table. You can register one or more URL patterns to the Route Continue Reading…

Explain ASP.NET MVC pipeline?

The detail ASP.NET MVC pipeline is given below: Routing – Routing is the first step in ASP.NET MVC pipeline. Typically, it is a pattern matching system that matches the incoming request to the registered URL patterns in the Route Table. The UrlRoutingModule(System.Web.Routing.UrlRoutingModule) is a class which matches an incoming HTTP request to a registered route Continue Reading…